Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


CSharp Programming

CSharp > Code Examples

Controlling The Storyboard

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
Controlling The Storyboard <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <StackPanel> <Canvas Width="360" Height="240"> <Rectangle Canvas.Left="120" Canvas.Top="60" Fill="Aqua" Width="60" Height="180"> <Rectangle.RenderTransform> <TransformGroup> <RotateTransform x:Name="xform1" Angle="-90" CenterX="0" CenterY="150" /> </TransformGroup> </Rectangle.RenderTransform> </Rectangle> </Canvas> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Button Name="btnBegin" Content="Begin" /> <Button Name="btnPause" Content="Pause" /> <Button Name="btnResume" Content="Resume" /> <Button Name="btnStop" Content="Stop" /> <Button Name="btnSkip" Content="Skip to End" /> <Button Name="btnCenter" Content="Skip to Center" /> </StackPanel> <StackPanel.Triggers> <EventTrigger SourceName="btnBegin" RoutedEvent="Button.Click"> <BeginStoryboard Name="storybrd"> <Storyboard > <DoubleAnimation Storyboard.TargetName="xform1" Storyboard.TargetProperty="Angle" From="-90" To="0" Duration="0:0:5" /> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger SourceName="btnPause" RoutedEvent="Button.Click"> <PauseStoryboard BeginStoryboardName="storybrd" /> </EventTrigger> <EventTrigger SourceName="btnResume" RoutedEvent="Button.Click"> <ResumeStoryboard BeginStoryboardName="storybrd" /> </EventTrigger> <EventTrigger SourceName="btnStop" RoutedEvent="Button.Click"> <StopStoryboard BeginStoryboardName="storybrd" /> </EventTrigger> <EventTrigger SourceName="btnSkip" RoutedEvent="Button.Click"> <SkipStoryboardToFill BeginStoryboardName="storybrd" /> </EventTrigger> <EventTrigger SourceName="btnCenter" RoutedEvent="Button.Click"> <SeekStoryboard BeginStoryboardName="storybrd" Offset="0:0:5" /> </EventTrigger> </StackPanel.Triggers> </StackPanel> </Page>