In This Article

Menu Class

Represents a menu control that can appear on a popup.

public class Menu : ItemsControl
Inheritance:
object Visual UIElement FrameworkElement Control ItemsControl object
Derived:
RecentDocumentMenu

Remarks

For detailed documentation on this control's features and how to use them, please see the Menu documentation topic.

Constructors

Menu()

Initializes an instance of the class.

public Menu()

Properties

ItemVariantSize

Gets or sets a VariantSize that specifies the variant size of contained controls.

public VariantSize ItemVariantSize { get; set; }

Property Value

VariantSize:

A VariantSize that specifies the variant size of contained controls.

Methods

GetCanUnhighlightWhenFocused(DependencyObject)

Gets the value of the CanUnhighlightWhenFocused attached property for the specified object.

public static bool GetCanUnhighlightWhenFocused(DependencyObject obj)
Parameter Type Description
obj DependencyObject

The object from which the property value is read.

Returns

bool:

The object's value.

GetContainerForItemOverride()

Creates or identifies the element used to display the specified item.

protected override sealed DependencyObject GetContainerForItemOverride()

Returns

DependencyObject:

The element that is used to display the given item.

GetIsMenuItemInputGestureTextVisible(DependencyObject)

Gets the value of the IsMenuItemInputGestureTextVisible attached property for the specified object.

public static bool GetIsMenuItemInputGestureTextVisible(DependencyObject obj)
Parameter Type Description
obj DependencyObject

The object from which the property value is read.

Returns

bool:

The object's value.

IsItemItsOwnContainerOverride(object)

Determines if the specified item is (or is eligible to be) its own item container.

protected override sealed bool IsItemItsOwnContainerOverride(object item)
Parameter Type Description
item object

Specified item.

Returns

bool:

true if the item is its own item container; otherwise, false.

OnCreateAutomationPeer()

Creates and returns an AutomationPeer object for this type.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The AutomationPeer that was created.

OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)

Called after the value of the IsKeyboardFocusWithin property has changed.

protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

A System.Windows.DependencyPropertyChangedEventArgs that contains the event data.

OnItemsChanged(NotifyCollectionChangedEventArgs)

Invoked when the Items property changes.

protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameter Type Description
e NotifyCollectionChangedEventArgs

A NotifyCollectionChangedEventArgs that contains the event data.

OnKeyDown(KeyEventArgs)

Invoked when an unhandled KeyDownEvent attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected override void OnKeyDown(KeyEventArgs e)
Parameter Type Description
e KeyEventArgs

The KeyEventArgs that contains the event data.

OnMouseLeave(MouseEventArgs)

Occurs when the mouse leaves the control.

protected override void OnMouseLeave(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

A MouseEventArgs that contains the event data.

OnPreviewMouseMove(MouseEventArgs)

Invoked when an unhandled Mouse.PreviewMouseMoveEvent attached event is raised on this element. Implement this method to add class handling for this event.

protected override void OnPreviewMouseMove(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

A MouseEventArgs that contains the event data.

OnPropertyChanged(DependencyPropertyChangedEventArgs)

Occurs when a property is changed.

protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

A System.Windows.DependencyPropertyChangedEventArgs that contains the event data.

OnTextInput(TextCompositionEventArgs)

Invoked when an unhandled UIElement.TextInputEvent attached event is raised on this element. Implement this method to add class handling for this event.

protected override void OnTextInput(TextCompositionEventArgs e)
Parameter Type Description
e TextCompositionEventArgs

A TextCompositionEventArgs that contains the event data.

SetCanUnhighlightWhenFocused(DependencyObject, bool)

Sets the value of the CanUnhighlightWhenFocused attached property to the specified object.

public static void SetCanUnhighlightWhenFocused(DependencyObject obj, bool value)
Parameter Type Description
obj DependencyObject

The object to which the attached property is written.

value bool

The value to set.

SetIsMenuItemInputGestureTextVisible(DependencyObject, bool)

Sets the value of the IsMenuItemInputGestureTextVisible attached property to the specified object.

public static void SetIsMenuItemInputGestureTextVisible(DependencyObject obj, bool value)
Parameter Type Description
obj DependencyObject

The object to which the attached property is written.

value bool

The value to set.

Fields

CanUnhighlightWhenFocusedProperty

Identifies the CanUnhighlightWhenFocused dependency property. This field is read-only.

public static readonly DependencyProperty CanUnhighlightWhenFocusedProperty

IsMenuItemInputGestureTextVisibleProperty

Identifies the IsMenuItemInputGestureTextVisible dependency property. This field is read-only.

public static readonly DependencyProperty IsMenuItemInputGestureTextVisibleProperty

ItemVariantSizeProperty

Identifies the ItemVariantSize dependency property. This field is read-only.

public static readonly DependencyProperty ItemVariantSizeProperty