Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-animate-a-popup.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

2.2 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
How to: Animate a Popup 03/30/2017
Popup control [WPF], animating
animation [WPF], Popup controls
acaa2a0a-6137-4efd-9cd1-75ece222e390

How to: Animate a Popup

This example shows two ways to animate a xref:System.Windows.Controls.Primitives.Popup control.

Example

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

In order to rotate the xref:System.Windows.Controls.Primitives.Popup, this example assigns a xref:System.Windows.Media.RotateTransform to the xref:System.Windows.UIElement.RenderTransform%2A property on the xref:System.Windows.Controls.Canvas, which is the child element of the xref:System.Windows.Controls.Primitives.Popup.

For the transform to work correctly, the example must set the xref:System.Windows.Controls.Primitives.Popup.AllowsTransparency%2A property to true. In addition, the xref:System.Windows.FrameworkElement.Margin%2A on the xref:System.Windows.Controls.Canvas content must specify enough space for the xref:System.Windows.Controls.Primitives.Popup to rotate.

[!code-xamlAnimatedPopup#RotateTransform2]

The following example shows how a xref:System.Windows.Controls.Primitives.ButtonBase.Click event, which occurs when a xref:System.Windows.Controls.Button is clicked, triggers the xref:System.Windows.Media.Animation.Storyboard that starts the animation.

[!code-xamlAnimatedPopup#RotateTransform1]

See also