WPF Storyboard Question
WPF Storyboard Question
WPF Storyboard Question
WPF Storyboard Question
WPF Storyboard Question
WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question
WPF Storyboard Question WPF Storyboard Question
WPF Storyboard Question
Go Back  Xtreme Visual Basic Talk > > > WPF Storyboard Question


Reply
 
Thread Tools Display Modes
  #1  
Old 11-05-2013, 08:02 AM
Patpop01 Patpop01 is offline
Newcomer
 
Join Date: Aug 2013
Posts: 4
Question WPF Storyboard Question


Hi,

I have a question to which I can't seem to find the answer anywhere... Perhaps on of you could help me out.

Code:
    Dim m_LeftWidth As Double = 200
    Dim m_LeftExpanding As Boolean = False
    Dim m_LeftCollapsing As Boolean = False

       Private Sub _LeftOptions_MouseEnter(ByVal sender As Object, ByVal e As MouseEventArgs)
        If ((ButtonLeft.IsChecked = False) And (m_LeftCollapsing = False)) Then
            m_LeftExpanding = True

            Dim sb As New Storyboard

            Dim myDoubleAnimation As New DoubleAnimation
            myDoubleAnimation.From = 0
            myDoubleAnimation.To = m_LeftWidth
            myDoubleAnimation.Duration = TimeSpan.FromMilliseconds(100)
            myDoubleAnimation.AutoReverse = False

            Storyboard.SetTargetName(myDoubleAnimation, "LeftSettings")
            Dim PropP As New PropertyPath(Grid.WidthProperty)
            Storyboard.SetTargetProperty(myDoubleAnimation, PropP)

             sb.Children.Add(myDoubleAnimation)
             Me.BeginStoryboard(sb)
 
           m_LeftExpanding = False
        End If
    End Sub
    Private Sub _LeftOptions_MouseLeave(ByVal sender As Object, ByVal e As MouseEventArgs)
        If ((ButtonLeft.IsChecked = False) And (m_LeftExpanding = False)) Then
            m_LeftCollapsing = True

            Dim sb As New Storyboard

            Dim myDoubleAnimation As New DoubleAnimation
            myDoubleAnimation.From = m_LeftWidth
            myDoubleAnimation.To = 0
            myDoubleAnimation.Duration = TimeSpan.FromMilliseconds(100)
            myDoubleAnimation.AutoReverse = False

            Storyboard.SetTargetName(myDoubleAnimation, "LeftSettings")
            Dim PropP As New PropertyPath(Grid.WidthProperty)
            Storyboard.SetTargetProperty(myDoubleAnimation, PropP)

             sb.Children.Add(myDoubleAnimation)
             Me.BeginStoryboard(sb)

            m_LeftCollapsing = False
        End If
    End Sub
As you can see I have some vb code, that handles events from a grid in WPF.
One event when entering and one event when leaving.

I am using a storyboard to get a width change animation.

But I would like to have the variables m_LeftExpanding and m_LeftCollapsing change value only after my storyboard has finished, in order to detect the collapsing or expanding has finished. They will we used in the if statements.

I have seen people using the storyboard completed triggers, but how can I define them programmatically and not in XAML?

The storyboards are not defined in XAML as there is a variable m_LeftSize that is not static and I have to check a wether or not a button outside of the grid has been checked or not...

Hope I made myself clear ... Any help would be appreciated.
Thx
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
WPF Storyboard Question
WPF Storyboard Question
WPF Storyboard Question WPF Storyboard Question
WPF Storyboard Question
WPF Storyboard Question
WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question WPF Storyboard Question
WPF Storyboard Question
WPF Storyboard Question
 
WPF Storyboard Question
WPF Storyboard Question
 
-->