Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
/** @property */ public Rect get_PlacementRectangle () /** @property */ public void set_PlacementRectangle (Rect value)
public function get PlacementRectangle () : Rect public function set PlacementRectangle (value : Rect)
<object> <object.PlacementRectangle> <Rect .../> </object.PlacementRectangle> </object>
Property ValueThe rectangle that is used to position the Popup control. The default value is a null reference (Nothing in Visual Basic).
Metadata properties set to true
The PlacementRectangle property specifies a rectangle relative to which the Popup control is positioned when it opens. If the PlacementTarget property is not a null reference (Nothing in Visual Basic), the rectangle is defined relative to the PlacementTarget object. Otherwise, the specified rectangle is defined relative to the upper-left corner of the screen.
This set of examples shows how to use the placement properties to specify the position of a Popup control.
You can determine the position of a Popup control by using the following properties:
The first four properties define a two-dimensional coordinate on the screen. The fifth property, Placement, positions the Popup and also defines its behavior if its content overlaps the screen boundaries.
Use a PlacementMode enumeration value to set the Placement property. For more information about the enumeration values for PlacementMode, see How to: Use the PlacementMode Enumeration to set Placement.
The following illustrations show how the placement properties work together to position a Popup control.
Popup placement by using the Placement property
Popup placement by using the Placement and PlacementRectangle properties
Popup placement by using the Placement, PlacementRectangle, and Offset properties
The following example shows how to set these Popup properties. For the complete sample, see Popup Position Sample.
Popup myPopup = new Popup(); myPopup.PlacementTarget = myEllipse; myPopup.PlacementRectangle = new Rect(0, 0, 30, 50); myPopup.VerticalOffset = 20; myPopup.HorizontalOffset = 20; myPopup.Placement = PlacementMode.Bottom; myPopup.PopupAnimation = PopupAnimation.Fade; myPopup.AllowsTransparency = true; TextBlock popupText = new TextBlock(); popupText.Background = Brushes.Beige; popupText.FontSize = 12; popupText.Width = 75; popupText.TextWrapping = TextWrapping.Wrap; myPopup.Child = popupText;
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.