VFPConversionLogo
HomeBlogLearnProductsEventsServicesAbout UsFAQ
Markus Egger's Blog

Thursday, January 12, 2006
Triggering Animations Programmatically in WPF/Avalon/XAML

In the past, it was possible to trigger animations in Avalon (WPF/XAML) programmatically by first finding an animation's timeline, then finding the associated storyboard clock, and then using that clock's controller to trigger the animation. Here is a typical example:

Timeline tl = this.FindName("myTimeline") as Timeline;
Clock clock = this.FindStoryboardClock(tl);
clock.ClockController.Begin();

This was a bit tricky and confusing. In the December 05 CTP build, this has changed. An animation can now be triggered relatively easily, simply by triggering a storyboard:

Storyboard s = this.FindResource("myStoryboard") as Storyboard;
s.Begin(this);

That's it! Much easier, and more intuitive. However, if you are used to the old way, you may end up searching for hours to figure out how easy it now is... ;-)

Note: This assumes that the animation is put into the resources section of the main scene/window/page. If the storyboard is located elsewhere, you'd have to reference it at that particular location.



Posted @ 7:37 PM by Egger, Markus (markus@code-magazine.com) - Comments


Blog List
VFPConversion Blog
Ken Levy's Blog
Claudio Lassala's Blog
Mike Yeager's Blog
Blog Archive
September, 2012 (1)
April, 2012 (1)
March, 2012 (1)
October, 2011 (1)
June, 2011 (3)
May, 2011 (1)
March, 2011 (2)
February, 2011 (2)
January, 2011 (2)
December, 2010 (3)
November, 2010 (2)
October, 2010 (2)
September, 2010 (1)
August, 2010 (2)
July, 2010 (1)
June, 2010 (1)
April, 2010 (3)
March, 2010 (1)
February, 2010 (5)
January, 2010 (1)
October, 2009 (4)
September, 2009 (2)
August, 2009 (1)
July, 2009 (1)
May, 2009 (4)
April, 2009 (6)
February, 2009 (1)
January, 2009 (1)
December, 2008 (3)
November, 2008 (11)
October, 2008 (8)
September, 2008 (1)
July, 2008 (1)
June, 2008 (3)
May, 2008 (3)
April, 2008 (6)
March, 2008 (6)
February, 2008 (4)
December, 2007 (1)
November, 2007 (1)
October, 2007 (5)
September, 2007 (1)
August, 2007 (1)
July, 2007 (6)
June, 2007 (3)
May, 2007 (3)
April, 2007 (1)
March, 2007 (2)
January, 2007 (2)
December, 2006 (3)
November, 2006 (4)
October, 2006 (1)
September, 2006 (2)
August, 2006 (2)
July, 2006 (4)
June, 2006 (1)
May, 2006 (2)
April, 2006 (10)
March, 2006 (2)
February, 2006 (3)
January, 2006 (1)
December, 2005 (6)
November, 2005 (7)
October, 2005 (6)
September, 2005 (8)
August, 2005 (10)
July, 2005 (6)
June, 2005 (9)