Caliburn.Micro Animation

Topics: Actions & Coroutines, Conventions, Getting Started
Nov 17, 2012 at 12:14 AM
Edited Nov 17, 2012 at 4:18 PM

So I've been searching far and wide for a decent sample or tutorial on Animation in Silverlight through Caliburn.Micro. Also, if whoever answers doesn't mind I also have an additional question at the end.

So, essentially, I have a Screen that contains a few Image controls that will fade in and out in series. I've never done animation in XAML before, but from what I understand it is done through storyboards like so:

 

<Storyboard>
    <DoubleAnimation From="1.0" To="0.0" Duration="0:0:1" AutoReverse="False" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="logo1" />
</Storyboard>

How would I handle starting, stopping, and iterating through the Storyboards in CM? I've seen bits and pieces involving VisualStateManager and DataTriggers but never enough of an example that I could actually figure out how to do it. The method I thought looked the most useful was described in this old blog post (http://devlicio.us/blogs/rob_eisenberg/archive/2009/07/10/asynchronous-execution-animation-and-more-in-mvvm-with-caliburn.aspx) but never elaborated, at least that I could find.

 

Thanks for any help!

Nov 17, 2012 at 3:27 PM
Edited Nov 17, 2012 at 3:35 PM

that particular blog was about caliburn.codeplex.com which was the predecessor to caliburn.micro it has stuff that might work for what you are trying to do.

specifically you are look for this item in the source, it might have some tangible goods to work from and it might not.  Rob would have better answer for this

http://caliburn.codeplex.com/SourceControl/changeset/view/e80dd6b444f4#src%2fCaliburn.ShellFramework%2fResults%2fAnimationResult.cs

it basically looks like a coroutine adapted to work with storyboards and run them sequentially

Nov 17, 2012 at 4:17 PM
Edited Nov 17, 2012 at 4:18 PM

Thanks, I didn't notice that was for the old version of Caliburn. I don't want to use that since Micro is the primary product now. The other methods will suffice, I just thought the one in the blog post looked most intuitive. I found this code here (http://compiledexperience.com/blog/posts/storyboards-in-caliburn-micro), but I don't know what to do with it :(. If someone could whip up a quick example with this code, I think that would be for the best.

Nov 17, 2012 at 10:50 PM
Edited Nov 17, 2012 at 10:51 PM

it is a sequence of coroutines to run the animation something along those lines, coroutines are in the docs.