Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Popup Class
Popup Properties
 PlacementTarget Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Popup..::.PlacementTarget Property

Gets or sets the element relative to which the Popup is positioned when it opens. This is a dependency property.

Namespace:  System.Windows.Controls.Primitives
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/xaml/presentation
Visual Basic (Declaration)
<BindableAttribute(True)> _
Public Property PlacementTarget As UIElement
Visual Basic (Usage)
Dim instance As Popup
Dim value As UIElement

value = instance.PlacementTarget

instance.PlacementTarget = value
C#
[BindableAttribute(true)]
public UIElement PlacementTarget { get; set; }
Visual C++
[BindableAttribute(true)]
public:
property UIElement^ PlacementTarget {
    UIElement^ get ();
    void set (UIElement^ value);
}
JScript
public function get PlacementTarget () : UIElement
public function set PlacementTarget (value : UIElement)
XAML Property Element Usage
<object>
  <object.PlacementTarget>
    <UIElement .../>
  </object.PlacementTarget>
</object>

Property Value

Type: System.Windows..::.UIElement
The UIElement that is the logical parent of the Popup control. The default is nullNothingnullptra null reference (Nothing in Visual Basic).

Identifier field

PlacementTargetProperty

Metadata properties set to true

None

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, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker