In This Article

MenuItem Class

Represents a menu item wrapper that is applied to items within a Menu control.

public class MenuItem : ContentControl
Inheritance:
object Visual UIElement FrameworkElement Control ContentControl object

Constructors

MenuItem()

Initializes an instance of the class.

public MenuItem()

Properties

IsContentEnabled

Gets or sets whether the content is enabled.

public bool IsContentEnabled { get; set; }

Property Value

bool:

true if the content is enabled; otherwise, false.

IsPopupOpen

Gets or sets whether a child popup is open.

public bool IsPopupOpen { get; set; }

Property Value

bool:

true if the a child popup is open; otherwise, false.

Methods

OnContentChanged(object, object)

Occurs when the content is changed.

protected override void OnContentChanged(object oldContent, object newContent)
Parameter Type Description
oldContent object

The old content.

newContent object

The new content.

OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)

Occurs after the control gains keyboard focus.

protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameter Type Description
e KeyboardFocusChangedEventArgs

A KeyboardFocusChangedEventArgs that contains the event data.

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.

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.

OnMouseMove(MouseEventArgs)

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

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

A MouseEventArgs that contains the event data.

Fields

IsContentEnabledProperty

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

public static readonly DependencyProperty IsContentEnabledProperty

IsPopupOpenProperty

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

public static readonly DependencyProperty IsPopupOpenProperty