Placement Attached Property

ContextMenuService.Placement Attached Property


Gets or sets a value that specifies the placement of the ContextMenu relative to the PlacementTarget or PlacementRectangle.

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

See GetPlacement, SetPlacement

Property Value

Type: System.Windows.Controls.Primitives.PlacementMode

Returns where the ContextMenu should be placed in relation to its parent. The property sets a PlacementMode.

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


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.

Return to top
© 2015 Microsoft