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

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();
}

Comments:

Add a Comment:

simple_captcha.jpg
(human authentication)


Ads

Categories

About

Random foliage

This website is meant to be a reference for ASP Dot Net developers. The entries are a compilation of things I've figured out how to do and that I deem useful to keep of track for future reference. Assumptions: web development with: C Sharp (vb sucks), visual studio 05/08, .net 3.5, meant for programmers. Written by: James Reategui.