c# - WPF re-size border at runtime -
does setting framework elements (border in case) width in xaml prevent me changing value @ run time?
i have grid containing border in turn contains other controls. have animation expands grid , border width , height increasing values 0.
i have placed button above border act re-sizing aid (it border-less window). here snippet of code should re-sizing border:
private void gridresize_click(object sender, routedeventargs e) { startpoint = this.pointtoscreen(mouse.getposition(this)); mouse.capture(gridresize); resizing = true; } private void window_mousemove(object sender, mouseeventargs e) { if (resizing) { frameworkelement border = (frameworkelement)libraryborder; //an arbitrary value testing border.width += 20; libraryborder.invalidatevisual(); } }
the initial animation sets borders width 1500. when debugging both events being registered , window_mousemove trying amend borders width. not alter value - remains @ 1500. cast element frameworkelement in hope allow me amend width property. assume xaml values somehow overriding code. ideas on how around this. thought ask before go route of moving animations in code discover there better way ( or code approach wont make difference!!).
thanks in advance answers
make sure storyboard
doesn't have fillbehavior holdend default. prevent changing width. see dependency property value precedence.
Comments
Post a Comment