PlacementRectangle Attached Property

ContextMenuService.PlacementRectangle Attached Property


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

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

See GetPlacementRectangle, SetPlacementRectangle

Property Value

Type: System.Windows.Rect

The Rect structure that defines the rectangle that is used to position the context menu control. The default is Empty.

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.

Identifier field


Metadata properties set to true


Legacy Code Example

The following example assigns the same ContextMenu to two buttons and sets the HasDropShadow, Placement, PlacementRectangle, HorizontalOffset, and VerticalOffset properties to set the ContextMenu to different positions for each button.

Code snippet is not found. Confirm that the code snippet name 'ContextMenuService_snip' is correct.
Return to top
© 2015 Microsoft