Begin Storyboard Animation from codebehind
Posted on: Tue Aug 04 15:18:21 -0700 2009. Updated on: Tue Aug 04 15:20:29 -0700 2009.
Category: WPF
Category: WPF
Animations with storyboards in WPF are cool, but often we need to be able to trigger them to start from cs codebehind. For example, on a button click. Here the animationKey param is the key that is defined in the xaml for your storyboard.
private void StartAnimation(string animationKey)
{
Storyboard pageViewAnimation = (Storyboard)FindResource(animationKey);
pageViewAnimation.Begin();
}