Search code examples
wpfanimationstackpanelcodeplex

Animating a stackpanel using Artefact


I'm trying to get animation working using Artefact Animator: Artefact on Codeplex

The relevant XAML:

    <Button x:Name="adminButton"
       Content="Admin Console"
       HorizontalAlignment="Left"
       Margin="25,215,0,0"
       VerticalAlignment="Top"
       Width="98"
       Click="adminPanelCall"/>

And:

    <StackPanel x:Name="adminPanel"
       Width="300"
       Background="#FFD4D4D4"
       Margin="750,0,0,0" />

In the code behind I have:

private void adminPanelCall(object sender, RoutedEventArgs e)
    {
        ArtefactAnimator.AddEase(adminPanel, Margin.Left, 500, 1, AnimationTransitions.CubicEaseInOut, 0);
    }

I'm referencing the WPF .dll and have made sure to include 'using Artefact.Animation;' I'm guessing the property I'm trying to animate is not correct?

Thank you for any help.


Solution

  • You can use the predefined constants in the AnimationTypes class to tell which property you want to animate:

    ArtefactAnimator.AddEase(adminPanel, AnimationTypes.MarginLeft, 500, 1, AnimationTransitions.CubicEaseInOut, 0);