Does setting a Framework elements (Border in this case) width in XAML prevent me from changing this value at run time?
I have a grid containing a border which in turn contains some other controls. I have an animation which expands the grid and border width and height increasing the values from 0.
I have then placed a button above the border to act as a re-sizing aid (it is a border-less window). here is a snippet of the code that should be re-sizing the 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 for testing border.Width += 20; LibraryBorder.InvalidateVisual(); } } The initial animation sets the borders width to 1500. When debugging both events are being registered and Window_MouseMove is trying to amend the borders width. It does not however alter the value - it remains at 1500. I cast the element to a FrameworkElement in the hope that this would allow me to amend the width property. I assume that my xaml values are somehow overriding my code. Any ideas on how to get around this. I thought I would ask before I go the route of moving all my animations in to code to discover there is a better way ( or that the code approach wont make a difference!!).
Thanks in advance for any answers