I resize a dock panel like this:
Private WithEvents PanelAnimation As New DoubleAnimation
Private WithEvents PanelSB As New Storyboard
With PanelAnimation
.From = WpfDockPanel.ActualHeight
.To = s
.Duration = New Duration(TimeSpan.FromSeconds(0.5))
.AccelerationRatio = 0.5
.DecelerationRatio = 0.5
End With
PanelSB.Children.Add(PanelAnimation)
Storyboard.SetTarget(PanelAnimation, WpfDockPanel)
Storyboard.SetTargetProperty(PanelAnimation, New PropertyPath(DockPanel.HeightProperty))
PanelSB.Begin(AviMainWindow)
..which works fine. Then, I want to manually set the size, but it won’t change, if I stop the code and type in a different size, the size won’t change, it is as though it is readonly.
But if I change the size once, not by animating, just by setting the size, I can change it again no problem. Why can’t I manually set the height after animating?
Thanks
This is because the animation’s FillBehavior is set to
HoldEndby default. You could set it toStop.You would however also have to set the
Heightproperty of the animation target to the desired end value manually before starting the animation. Otherwise it would flip back to the value it had before the animation was started.