Expand Minimize
This topic has not yet been rated - Rate this topic

PopupAnimation Enumeration

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Describes how a Popup control animates when it opens.

Namespace:  System.Windows.Controls.Primitives
Assembly:  PresentationFramework (in PresentationFramework.dll)
public enum class PopupAnimation
<object property="enumerationMemberName" .../>
Member nameDescription
NoneThe Popup control appears without animation.
FadeThe Popup control gradually appears, or fades in. This effect is created by increasing the opacity of the Popup window over time.
SlideThe Popup control slides down or up into place. By default, a Popup slides down. However, if the screen does not provide enough room for the Popup to slide down, it slides up instead.
ScrollThe Popup control scrolls from the upper-left corner of its parent. If the screen does not provide enough room to allow the Popup default behavior, the Popup scrolls from the lower-right corner instead.

To specify a type of animation for a Popup control, set the PopupAnimation property to one of the enumeration values.

This example shows two ways to animate a Popup control.

The following example sets the PopupAnimation property to a value of Slide, which causes the Popup to "slide-in" when it appears.

In order to rotate the Popup, this example assigns a RotateTransform to the RenderTransform property on the Canvas, which is the child element of the Popup.

For the transform to work correctly, the example must set the AllowsTransparency property to true. In addition, the Margin on the Canvas content must specify enough space for the Popup to rotate.


<Popup IsOpen="{Binding ElementName=myCheckBox,Path=IsChecked}" 
       PlacementTarget="{Binding ElementName=myCheckBox}"            
       AllowsTransparency="True"
       PopupAnimation="Slide"
       HorizontalOffset="50"
       VerticalOffset="50"
       >
  <!--The Margin set on the Canvas provides the additional 
      area around the Popup so that the Popup is visible when 
      it rotates.-->
  <Canvas Width="100" Height="100" Background="DarkBlue"
          Margin="150">
    <Canvas.RenderTransform>
      <RotateTransform x:Name="theTransform" />
    </Canvas.RenderTransform>
    <TextBlock TextWrapping="Wrap" Foreground="White">
      Rotating Popup
    </TextBlock>
  </Canvas>
</Popup>


The following example shows how a Click event, which occurs when a Button is clicked, triggers the Storyboard that starts the animation.


<Button HorizontalAlignment="Left" Width="200" Margin="20,10,0,0">
  <Button.Triggers>
    <EventTrigger RoutedEvent="Button.Click">
      <BeginStoryboard>
        <Storyboard>
          <DoubleAnimation 
            Storyboard.TargetName="theTransform"
            Storyboard.TargetProperty="(RotateTransform.Angle)" 
            From="0" To="360" Duration="0:0:5" AutoReverse="True"/>
        </Storyboard>
      </BeginStoryboard>
    </EventTrigger>
  </Button.Triggers>
  Click to see the Popup animate
</Button>


.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8 Consumer Preview, Windows Server 8 Beta, Windows 7, Windows Server 2008 SP2, Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.