Skip to main content

ContextMenu Members

Represents a flyout menu that can be attached to any visual element.

Constructors

Name Description
ContextMenu() Initializes a new instance of the ContextMenu class with the default settings.
ContextMenu(FrameworkElement, Boolean)
ContextMenu(FrameworkElement) Initializes a new instance of the ContextMenu class with the specified settings.

Fields

Name Description
ContentProperty static Identifies the ContextMenu.Content dependency property.
FlyoutPlacementBehaviorProperty static Identifies the ContextMenu.FlyoutPlacementBehavior dependency property.
FlyoutSettingsProperty static Identifies the ContextMenu.FlyoutSettings dependency property.
HeaderProperty static Identifies the ContextMenu.Header dependency property.
MenuProperty static Identifies the ContextMenu.Menu dependency property.
RequestedThemeProperty static Identifies the ContextMenu.RequestedTheme dependency property.

Properties

Name Description
Content Gets or sets the UI element that represents the context menu. This is a dependency property.
FlyoutSettings Gets or sets the flyout settings applied to the menu. This is a dependency property.
Header Gets or sets the menu header. This is a dependency property.
IsOpen Gets whether the menu is currently opened.
RequestedTheme Gets or sets the theme that should be used for the menu content specified by the ContextMenu.Content property.

Methods

Name Description
Close() Closes the context menu.
Equals(Object, Object) static Determines whether the specified object instances are considered equal. Inherited from Object.
Equals(Object) Determines whether the specified object is equal to the current object. Inherited from Object.
GetFlyoutPlacementBehavior(FlyoutBase) static Gets the value of the ContextMenu.FlyoutPlacementBehavior attached property for a specified flyout element.
GetHashCode() Serves as the default hash function. Inherited from Object.
GetMenu(DependencyObject) static Gets the value of the ContextMenu.Menu attached property for a specified DependencyObject.
GetType() Gets the Type of the current instance. Inherited from Object.
MemberwiseClone() protected Creates a shallow copy of the current Object. Inherited from Object.
Open() Opens the context menu.
Open(ContextMenuInfo) Opens the context menu.
Open(Object, Object, UIElement, Point, String, FlyoutSettingsBase) Opens the context menu.
Open(Point) Opens the context menu.
ReferenceEquals(Object, Object) static Determines whether the specified Object instances are the same instance. Inherited from Object.
SetFlyoutPlacementBehavior(FlyoutBase, FlyoutPlacementBehavior) static Sets the value of the ContextMenu.FlyoutPlacementBehavior attached property to a specified flyout element.
SetMenu(DependencyObject, ContextMenu) static Sets the value of the ContextMenu.Menu attached property to a specified DependencyObject.
ToString() Returns a string that represents the current object. Inherited from Object.

Events

Name Description
Closed Fires after the context menu has been closed.
Opened Fires after the context menu has been opened.
Opening Fires when the context menu is about to be invoked.

Attached Properties

Name Description
FlyoutPlacementBehavior static Gets or sets whether the menu is aligned relative to its target or the cursor. This is an attached property. This is a dependency property.
Menu static Gets or sets the Context Menu assigned to the visual element. This is an attached property. This is a dependency property.
See Also