Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 774
Priyank Thakkar Avatar asked Nov 19 '13 11:11

Priyank Thakkar


1 Answers

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.

like image 84
Noctis Avatar answered Sep 18 '22 19:09

Noctis