ContextMenu.PlacementRectangle 属性

定义

获取或设置上下文菜单打开时与其所在位置相对的区域。Gets or sets the area relative to which the context menu is positioned when it opens.

public:
 property System::Windows::Rect PlacementRectangle { System::Windows::Rect get(); void set(System::Windows::Rect value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.Rect PlacementRectangle { get; set; }
member this.PlacementRectangle : System.Windows.Rect with get, set
Public Property PlacementRectangle As Rect

属性值

定义用于定位上下文菜单的矩形的区域。The area that defines the rectangle that is used to position the context menu. 默认值为 EmptyThe default is Empty.

属性

示例

下面的示例演示如何使用PlacementRectangle属性并指定放置ContextMenu位置。The following example shows how to use the PlacementRectangle property and specify where the ContextMenu is placed.

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

注解

ContextMenu Placement PlacementRectangle通过设置、、HorizontalOffset、和VerticalOffsetProperty属性, 可以定位。 PlacementTargetYou can position a ContextMenu by setting the PlacementTarget, PlacementRectangle, Placement, HorizontalOffset, and VerticalOffsetProperty properties. 这些属性的行为与对Popup的行为相同。These properties behave the same as they do for a Popup. 有关详细信息,请参阅 Popup 放置行为For more information, see Popup Placement Behavior.

依赖项属性信息Dependency Property Information

标识符字段Identifier field PlacementRectangleProperty
元数据属性设置为trueMetadata properties set to true NoneNone

适用于

另请参阅