ContextMenu.PlacementRectangle Property

Definition

Gets or sets the area relative to which the context menu is positioned when it opens.

C#
[System.ComponentModel.Bindable(true)]
public System.Windows.Rect PlacementRectangle { get; set; }

Property Value

The area that defines the rectangle that is used to position the context menu. The default is Empty.

Attributes

Examples

The following example shows how to use the PlacementRectangle property and specify where the ContextMenu is placed.

XAML
<ContextMenu Placement="Bottom" PlacementRectangle="30,50,0,0">

Remarks

You can position a ContextMenu by setting the PlacementTarget, PlacementRectangle, Placement, HorizontalOffset, and VerticalOffsetProperty properties. These properties behave the same as they do for a Popup. For more information, see Popup Placement Behavior.

Dependency Property Information

Item Value
Identifier field PlacementRectangleProperty
Metadata properties set to true None

Applies to

Proizvod Verzije
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also