scale animation for wpf popup

Posted by wpf on Stack Overflow See other posts from Stack Overflow or by wpf
Published on 2010-04-09T12:30:03Z Indexed on 2010/04/09 12:33 UTC
Read the original article Hit count: 973

Filed under:
|
|

I have a nice little popup, when it shows, I d'like it to growth from 0 to 1x scaley, but I don't get it right, when I click multiple times, it looks like i "catch" the animation at various states during the "growth".

<Window.Triggers>

    <EventTrigger RoutedEvent="FrameworkElement.MouseRightButtonDown" 
                  >
        <EventTrigger.Actions>
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                        Storyboard.TargetName="SimplePopup" 
                        Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                        <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>

                </Storyboard>
            </BeginStoryboard>
        </EventTrigger.Actions>
    </EventTrigger>

</Window.Triggers>

and the popup:

   <Popup Name="SimplePopup"
           AllowsTransparency="True" 
           StaysOpen="False">
        <Popup.LayoutTransform>
            <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1" />
                <SkewTransform AngleX="0" AngleY="0" />
                <RotateTransform Angle="0" />
                <TranslateTransform X="0" Y="0" />
            </TransformGroup>
        </Popup.LayoutTransform>
        <Border> some Content here
          </Border>
    </Popup>

© Stack Overflow or respective owner

Related posts about wpf

Related posts about scale