0

I have applied a storyboard animation at design time to change a stackpanel width. But when I explicitly change same control's width on a button click, then there is no change in its width. When I do not apply any storyBoard at design time, then width change works.

Is there any way to remove storyboard binding from a panel control and apply same whenever I want on a button click.

thanks

Rohit Arora
  • 51
  • 1
  • 3

1 Answers1

0

DependencyPropertys react to change requests from different sources with different precedences. You can find out more in the Dependency Property Value Precedence article on MSDN. In your situation, the change requests to the StackPanel.Width DependencyProperty sent from the Animation object override any changes made in a Trigger Setter object.

The easiest thing to do is to pause or stop the Storyboard in the Button.Click handler before you change the StackPanel.Width. See this post which deals with a similar situation. You can find further information in the MSDN Storyboard.Pause Method article.

Community
  • 1
  • 1
Sheridan
  • 68,826
  • 24
  • 143
  • 183