![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Begin and Pause animation I cannot seem to figure out how to have 2 separate buttons play and pause an animation respectively. The PauseStoryboard requires a BeginStoryboardName which can only be defined in the trigger of the other button ( I think, that or the resources of the root ). I have tried to put the BeginStoryboard in the root resources but then I am forced to use a x:Key rather than a Name property, and it then fails to resolve the BeginStoryboardName. For interactive animation this seems like an oversight, does anyone know if this is going to change or suggest a change to get this to work? What if I want 2 ways to start an animation, I guess I would need 2 BeginStoryboards, how could I pause both begins properly? Is there a reason that PauseStoryboard cannot just reference the storyboard in the same way BeginStoryboard does, I think it would make things a little more straight forward. Thanks, xaml is below Jason //------------------------------------------------------------------------------------- <Canvas Name="Canvas1" Width="800" Height="600" Background="#00FFFFFF" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Canvas.Resources> <Storyboard x:Key="Storyboard_0" Duration="00:00:15"> <Storyboard.Children> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Rectangle1" Storyboard.TargetProperty="(Canvas.Left)"> <LinearDoubleKeyFrame KeyTime="00:00:00" Value="100"/> <LinearDoubleKeyFrame KeyTime="00:00:03" Value="500"/> </DoubleAnimationUsingKeyFrames> </Storyboard.Children> </Storyboard> <BeginStoryboard x:Key="Storyboard_0_Begin" HandoffBehavior="Compose" Storyboard="{StaticResource Storyboard_0}"/> <PauseStoryboard x:Key="Storyboard_0_Pause" BeginStoryboardName="Storyboard_0_Begin"/> </Canvas.Resources> <Rectangle Name="Rectangle1" Width="88" Height="94" Stroke="#FF000000" StrokeThickness="2" Canvas.Left="513" Canvas.Top="192"> <Rectangle.Fill> <LinearGradientBrush EndPoint="0.707106781186548,0.707106781186547"> <LinearGradientBrush.GradientStops> <GradientStop Color="#FF0000FF"/> <GradientStop Color="#FF00008B" Offset="1"/> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> <Button Name="Button1" Width="93" Height="29" FontFamily="Arial" FontSize="12" Canvas.Left="230" Canvas.Top="76" Content="Play"> <Button.Triggers> <EventTrigger RoutedEvent="ButtonBase.Click"> <EventTrigger.Actions> <!--<StaticResource ResourceKey="Storyboard_0_Begin"/> --> <BeginStoryboard Name="Storyboard_0_Begin" HandoffBehavior="Compose" Storyboard="{StaticResource Storyboard_0}"/> </EventTrigger.Actions> </EventTrigger> </Button.Triggers> </Button> <Button Name="Button2" Width="93" Height="29" FontFamily="Arial" FontSize="12" Canvas.Left="380" Canvas.Top="76" Content="Pause"> <Button.Triggers> <EventTrigger RoutedEvent="ButtonBase.Click"> <EventTrigger.Actions> <!--<StaticResource ResourceKey="Storyboard_0_Pause"/> --> <PauseStoryboard BeginStoryboardName="Storyboard_0_Begin"/> </EventTrigger.Actions> </EventTrigger> </Button.Triggers> </Button> </Canvas> |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Begin and Pause animation http://windowssdk.msdn.microsoft.com...aa16f1c15f.asp -- Valentin Iliescu [MVP - Client Application Development] "Jason [Mobiform]" wrote: > I cannot seem to figure out how to have 2 separate buttons play and pause an > animation respectively. The PauseStoryboard requires a BeginStoryboardName > which can only be defined in the trigger of the other button ( I think, that > or the resources of the root ). I have tried to put the BeginStoryboard in > the root resources but then I am forced to use a x:Key rather than a Name > property, and it then fails to resolve the BeginStoryboardName. > > For interactive animation this seems like an oversight, does anyone know if > this is going to change or suggest a change to get this to work? What if I > want 2 ways to start an animation, I guess I would need 2 BeginStoryboards, > how could I pause both begins properly? > > Is there a reason that PauseStoryboard cannot just reference the storyboard > in the same way BeginStoryboard does, I think it would make things a little > more straight forward. > > Thanks, xaml is below > Jason > > //------------------------------------------------------------------------------------- > > <Canvas Name="Canvas1" Width="800" Height="600" Background="#00FFFFFF" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> > <Canvas.Resources> > <Storyboard x:Key="Storyboard_0" Duration="00:00:15"> > <Storyboard.Children> > <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Rectangle1" > Storyboard.TargetProperty="(Canvas.Left)"> > <LinearDoubleKeyFrame KeyTime="00:00:00" Value="100"/> > <LinearDoubleKeyFrame KeyTime="00:00:03" Value="500"/> > </DoubleAnimationUsingKeyFrames> > </Storyboard.Children> > </Storyboard> > > > <BeginStoryboard x:Key="Storyboard_0_Begin" HandoffBehavior="Compose" > Storyboard="{StaticResource Storyboard_0}"/> > <PauseStoryboard x:Key="Storyboard_0_Pause" > BeginStoryboardName="Storyboard_0_Begin"/> > > </Canvas.Resources> > <Rectangle Name="Rectangle1" Width="88" Height="94" Stroke="#FF000000" > StrokeThickness="2" Canvas.Left="513" Canvas.Top="192"> > <Rectangle.Fill> > <LinearGradientBrush EndPoint="0.707106781186548,0.707106781186547"> > <LinearGradientBrush.GradientStops> > <GradientStop Color="#FF0000FF"/> > <GradientStop Color="#FF00008B" Offset="1"/> > </LinearGradientBrush.GradientStops> > </LinearGradientBrush> > </Rectangle.Fill> > </Rectangle> > <Button Name="Button1" Width="93" Height="29" FontFamily="Arial" > FontSize="12" Canvas.Left="230" Canvas.Top="76" Content="Play"> > <Button.Triggers> > > > <EventTrigger RoutedEvent="ButtonBase.Click"> > <EventTrigger.Actions> > <!--<StaticResource ResourceKey="Storyboard_0_Begin"/> --> > <BeginStoryboard Name="Storyboard_0_Begin" HandoffBehavior="Compose" > Storyboard="{StaticResource Storyboard_0}"/> > </EventTrigger.Actions> > </EventTrigger> > > > </Button.Triggers> > </Button> > > <Button Name="Button2" Width="93" Height="29" FontFamily="Arial" > FontSize="12" Canvas.Left="380" Canvas.Top="76" Content="Pause"> > <Button.Triggers> > > > <EventTrigger RoutedEvent="ButtonBase.Click"> > <EventTrigger.Actions> > <!--<StaticResource ResourceKey="Storyboard_0_Pause"/> --> > <PauseStoryboard BeginStoryboardName="Storyboard_0_Begin"/> > </EventTrigger.Actions> > </EventTrigger> > > </Button.Triggers> > </Button> > > > </Canvas> > > > > > |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Begin and Pause animation Ah thanks "viliescu" <viliescu@discussions.microsoft.com> wrote in message news:11DC52DC-3196-4C1E-AAC3-EB567138304A@microsoft.com... > http://windowssdk.msdn.microsoft.com...aa16f1c15f.asp > -- > Valentin Iliescu [MVP - Client Application Development] > > > "Jason [Mobiform]" wrote: > >> I cannot seem to figure out how to have 2 separate buttons play and pause >> an >> animation respectively. The PauseStoryboard requires a >> BeginStoryboardName >> which can only be defined in the trigger of the other button ( I think, >> that >> or the resources of the root ). I have tried to put the BeginStoryboard >> in >> the root resources but then I am forced to use a x:Key rather than a Name >> property, and it then fails to resolve the BeginStoryboardName. >> >> For interactive animation this seems like an oversight, does anyone know >> if >> this is going to change or suggest a change to get this to work? What if >> I >> want 2 ways to start an animation, I guess I would need 2 >> BeginStoryboards, >> how could I pause both begins properly? >> >> Is there a reason that PauseStoryboard cannot just reference the >> storyboard >> in the same way BeginStoryboard does, I think it would make things a >> little >> more straight forward. >> >> Thanks, xaml is below >> Jason >> >> //------------------------------------------------------------------------------------- >> >> <Canvas Name="Canvas1" Width="800" Height="600" Background="#00FFFFFF" >> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> >> <Canvas.Resources> >> <Storyboard x:Key="Storyboard_0" Duration="00:00:15"> >> <Storyboard.Children> >> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Rectangle1" >> Storyboard.TargetProperty="(Canvas.Left)"> >> <LinearDoubleKeyFrame KeyTime="00:00:00" Value="100"/> >> <LinearDoubleKeyFrame KeyTime="00:00:03" Value="500"/> >> </DoubleAnimationUsingKeyFrames> >> </Storyboard.Children> >> </Storyboard> >> >> >> <BeginStoryboard x:Key="Storyboard_0_Begin" HandoffBehavior="Compose" >> Storyboard="{StaticResource Storyboard_0}"/> >> <PauseStoryboard x:Key="Storyboard_0_Pause" >> BeginStoryboardName="Storyboard_0_Begin"/> >> >> </Canvas.Resources> >> <Rectangle Name="Rectangle1" Width="88" Height="94" Stroke="#FF000000" >> StrokeThickness="2" Canvas.Left="513" Canvas.Top="192"> >> <Rectangle.Fill> >> <LinearGradientBrush >> EndPoint="0.707106781186548,0.707106781186547"> >> <LinearGradientBrush.GradientStops> >> <GradientStop Color="#FF0000FF"/> >> <GradientStop Color="#FF00008B" Offset="1"/> >> </LinearGradientBrush.GradientStops> >> </LinearGradientBrush> >> </Rectangle.Fill> >> </Rectangle> >> <Button Name="Button1" Width="93" Height="29" FontFamily="Arial" >> FontSize="12" Canvas.Left="230" Canvas.Top="76" Content="Play"> >> <Button.Triggers> >> >> >> <EventTrigger RoutedEvent="ButtonBase.Click"> >> <EventTrigger.Actions> >> <!--<StaticResource ResourceKey="Storyboard_0_Begin"/> --> >> <BeginStoryboard Name="Storyboard_0_Begin" HandoffBehavior="Compose" >> Storyboard="{StaticResource Storyboard_0}"/> >> </EventTrigger.Actions> >> </EventTrigger> >> >> >> </Button.Triggers> >> </Button> >> >> <Button Name="Button2" Width="93" Height="29" FontFamily="Arial" >> FontSize="12" Canvas.Left="380" Canvas.Top="76" Content="Pause"> >> <Button.Triggers> >> >> >> <EventTrigger RoutedEvent="ButtonBase.Click"> >> <EventTrigger.Actions> >> <!--<StaticResource ResourceKey="Storyboard_0_Pause"/> --> >> <PauseStoryboard BeginStoryboardName="Storyboard_0_Begin"/> >> </EventTrigger.Actions> >> </EventTrigger> >> >> </Button.Triggers> >> </Button> >> >> >> </Canvas> >> >> >> >> >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: vbscript pause | Chongy | VB Script | 3 | 05-31-2008 09:09 AM |
| and now the updates begin | cm | Vista General | 8 | 07-11-2007 07:04 PM |
| PowerShell Equ of PAUSE | BJ Stigall | PowerShell | 10 | 02-26-2007 09:09 AM |
| New to RC1 and won't even begin to install....... | Quadracer200 | Vista installation & setup | 11 | 10-30-2006 02:32 PM |
| Can't begin install | Silofolous | Vista General | 2 | 06-09-2006 09:06 PM |