mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-05 23:42:58 +02:00
* 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
34 lines
2.2 KiB
Markdown
34 lines
2.2 KiB
Markdown
---
|
|
title: "How to: Animate a Popup"
|
|
ms.date: "03/30/2017"
|
|
helpviewer_keywords:
|
|
- "Popup control [WPF], animating"
|
|
- "animation [WPF], Popup controls"
|
|
ms.assetid: 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-xaml[AnimatedPopup#RotateTransform2](~/samples/snippets/csharp/VS_Snippets_Wpf/AnimatedPopup/CS/Window1.xaml#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-xaml[AnimatedPopup#RotateTransform1](~/samples/snippets/csharp/VS_Snippets_Wpf/AnimatedPopup/CS/Window1.xaml#rotatetransform1)]
|
|
|
|
## See also
|
|
|
|
- <xref:System.Windows.UIElement.RenderTransform%2A>
|
|
- <xref:System.Windows.Controls.Primitives.BulletDecorator>
|
|
- <xref:System.Windows.Media.RotateTransform>
|
|
- <xref:System.Windows.Media.Animation.Storyboard>
|
|
- <xref:System.Windows.Controls.Primitives.Popup>
|
|
- [How-to Topics](popup-how-to-topics.md)
|
|
- [Popup Overview](popup-overview.md)
|