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 Tutorial - PauseStoryboard problem

 
 
Old 07-04-2008   #1 (permalink)
Saitir
Guest


 
 

PauseStoryboard problem

Hi All,
I am experiencing a problem which is turning out to be a bit of a catch
22.

I am coding a WPF application with VB code behind it. I have an storyboard
that changes every 10 seconds to display a revolving set of company names.
I added three buttons; one to pause the animation, resume and skip the
animation to the next set of company names.

This all works but only for the first time the storyboard clock runs for.
After this storyboard ends I re-run the animation using VB code from the
storyboard_completed event.

This also works fine but after it has been re-run the pause, resume and
'skip' buttons no longer work with the animation.

I know I could add repeatbehaviour="Forever" to the storyboard and this
actually solves the problem with the pause and resume buttons not working,
but then that would break by 'skip' button which uses SkipStoryboardToFill.
As the storyboard would no longer have an end, this button can not move it to
the end of the current animation and allow me to display then next set of
company names.

Here are the key sections of code I am using:
XAML:

<Border Name="CompaniesBorder">
<Border.Triggers>
<EventTrigger RoutedEvent="Border.Loaded">
<EventTrigger.Actions>
<BeginStoryboard Name="BeginCompaniesAnimation">
<Storyboard Name="CompaniesAnimation"
Duration="0:0:10" Storyboard.TargetProperty="Opacity">
<DoubleAnimation Name="DoublePos1"
Storyboard.TargetName ="Pos1" From="0" To="0.75" BeginTime="0:0:0.00"
Duration="0:0:0.5"/>
<DoubleAnimation Name="DoublePos2"
Storyboard.TargetName ="Pos2" From="0" To="0.75" BeginTime="0:0:0.10"
Duration="0:0:0.5" />
<DoubleAnimation Name="DoublePos3"
Storyboard.TargetName ="Pos3" From="0" To="0.75" BeginTime="0:0:0.20"
Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger SourceName="btnPause"
RoutedEvent="Button.Click">
<PauseStoryboard
BeginStoryboardName="BeginCompaniesAnimation" />
</EventTrigger>
<EventTrigger SourceName="btnSkip" RoutedEvent="Button.Click">
<SkipStoryboardToFill
BeginStoryboardName="BeginCompaniesAnimation" />
</EventTrigger>
<EventTrigger SourceName="btnResume"
RoutedEvent="Button.Click">
<ResumeStoryboard
BeginStoryboardName="BeginCompaniesAnimation" />
</EventTrigger>
</Border.Triggers>

VB.NET:

Private Sub CompaniesAnimation_Completed(ByVal sender As Object, ByVal e
As System.EventArgs) Handles CompaniesAnimation.Completed
CompaniesBorder.BeginStoryboard(CompaniesAnimation)
End Sub



Thanks in advance for any help.

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
the problem with ndis.sys Blue Screen of Death problem solved? Vista General
Re: Windows Mail Attachement Problem and Adobe Player Problem with IE8 Vista mail
Generic McAfee Problem Message in Vista Problem Reports Vista performance & maintenance
fixed unable to delete email problem, now I have new problem Vista mail
Vista Upgrade Problem - Windows Explorer Loop problem Vista installation & setup


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