Popup.PlacementTarget Property
Gets or sets the element relative to which the Popup is positioned when it opens.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
<object> <object.PlacementTarget> <UIElement .../> </object.PlacementTarget> </object>
Property Value
Type: System.Windows.UIElementThe UIElement that is the logical parent of the Popup control. The default is null.
You can position a popup by setting the PlacementTarget, PlacementRectangle, Placement, HorizontalOffset, and VerticalOffsetProperty properties. For more information, see Popup Placement Behavior.
The following example creates a Popup that is the child of a Canvas, and sets PlacementTarget to ellipse1, so the popup is relative to the Ellipse.
<Canvas Margin="5" Background="Red" Width="200" Height="150" > <Ellipse Name="ellipse1" Canvas.Top="60" Canvas.Left="50" Height="85" Width="60" Fill="Black"/> <Popup IsOpen="True" PlacementTarget="{Binding ElementName=ellipse1}"> <TextBlock Background="LightBlue" FontSize="18">This is a Popup</TextBlock> </Popup> </Canvas>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.