Priyank Thakkar
Priyank Thakkar

Reputation: 4852

WPF Popup : open with animation

I am using a wpf popup control.

<Popup x:Name="tabHolder" IsOpen="False" 
    PopupAnimation="Slide" Placement="Bottom" 
    PlacementTarget="{Binding ElementName=mainWidgetWindow}">
    <Grid Height="105" Width="315" />
</Popup>

Here I have set popup animation property to slide. But when it opens, it doesn't animate. Do I have to add any other configuration for popup to open with animation option slide?

I am using .net framework version 3.5.

Upvotes: 12

Views: 19591

Answers (2)

Noctis
Noctis

Reputation: 11763

From MSDN

A Popup can only animate when the AllowsTransparency property is set to true. This requires the application that creates the Popup control to run with full trust. If the PlacementTarget is animated, the Popup will not be animated.

XAML should look like

<DockPanel  Width="500" Background="Aqua">
  <Popup Placement="Center" PlacementRectangle="0,0,30,50"  
          IsOpen ="True" AllowsTransparency="True"
          PopupAnimation="Fade">
    <TextBlock Background="Purple">Popup Text</TextBlock>
  </Popup>
</DockPanel>

And you can read more here.

Upvotes: 28

J R B
J R B

Reputation: 2136

Popup will animate if you have set AllowsTransparency true. like -

AllowsTransparency="True".

Upvotes: 6

Related Questions