Search code examples
wpfstoryboardvisualstatemanager

WPF VisualStateManger - How to rewind a Storyboard or go back to previous State?


The title describes it at best. I want to switch back to a default state after a specific State is completed. I tried this by using an EventTrigger for the Completed event of the Storyboard, but that doesn't work, because the Storyboard is in a frozen (IsFrozen) state (in order to allow cross-thread access to it) and cannot be modified.


Solution

  • You can use the StateChangedTrigger with the Completed parameter set to true from http://expressionblend.codeplex.com/wikipage?title=Behaviors%20and%20Effects&referringTitle=Documentation

    Only thing is, if you're using WPF4, you'll need the fixed code: http://expressionblend.codeplex.com/workitem/8148