Geeks With Blogs

News




What I do:

Identity Mine

MVVM Light

GalaSoft


What I am:

Microsoft Most Valuable Professional, Client Application Development

Microsoft Certified Technology Specialist, Windows Presentation Foundation

WPF disciples


Social:


View my profile on LinkedIn

XING
Creative Commons License
Diary of a Code Trotter by Laurent Bugnion is licensed under a Creative Commons Attribution 3.0 Unported License

All source code on this blog is licensed under the MIT license.

Copyright (c) 2006 - 2011 GalaSoft Laurent Bugnion

Laurent Bugnion (GalaSoft) Diary of a Code Trotter
WPF makes it very easy to define animations, by using timelines, storyboards and dependency properties. Animations can be defined and triggered in XAML, or they can be defined in XAML and triggered in C#, or they can even be fully defined and triggered in C#.
I just published a tutorial explaining the basic concepts of animations in WPF, with examples and a demo (runs in IE, with WPF September CTP (RC1) installed). The article shows 3 different ways to animate an object. Of course, you can also download the source code.
<Page.Triggers>
  <EventTrigger RoutedEvent="TextBlock.MouseDown"
                SourceName="lblHello">
    <EventTrigger.Actions>
      <BeginStoryboard>
        <Storyboard>
          <DoubleAnimation
            Storyboard.TargetName="lblHello"
            Storyboard.TargetProperty="(TextBlock.RenderTransform).(RotateTransform.Angle)"
            From="0"
            To="360"
            Duration="0:0:0.5"
            RepeatBehavior="4x" />
        </Storyboard>
      </BeginStoryboard>
    </EventTrigger.Actions>
  </EventTrigger>
</Page.Triggers>
WPF animation in XAML
Posted on Saturday, October 28, 2006 8:39 PM Technical stuff , .NET , WPF | Back to top


Comments on this post: WPF: Animations in XAML and code-behind

# re: WPF: Animations in XAML and code-behind
Requesting Gravatar...
I can't get a video to loop. Do I use repeatBehavior for this?
Left by Metropolis12 on Mar 10, 2007 10:53 PM

Comments have been closed on this topic.
Copyright © Laurent Bugnion | Powered by: GeeksWithBlogs.net