Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Begin and Pause animation

 
 
Old 04-20-2006   #1 (permalink)
Jason [Mobiform]


 
 

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 SpecsSystem Spec
Old 04-20-2006   #2 (permalink)
viliescu


 
 

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 SpecsSystem Spec
Old 04-20-2006   #3 (permalink)
Jason [Mobiform]


 
 

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 SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Where to begin General Discussion
and now the updates begin Vista General
PowerShell Equ of PAUSE PowerShell
New to RC1 and won't even begin to install....... Vista installation & setup
Can't begin install Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

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