Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Fri, 4 Jul 2008 04:08:01 -0700,    group: microsoft.public.windows.developer.winfx.avalon        back       


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.
date: Fri, 4 Jul 2008 04:08:01 -0700   author:   Saitir

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us