In This Article

BarMainMenu Class

Represents a main menu.

public class BarMainMenu : Menu
Inheritance:
object Visual UIElement FrameworkElement Control ItemsControl MenuBase Menu object

Constructors

BarMainMenu()

Initializes a new instance of the BarMainMenu class.

public BarMainMenu()

Methods

ClearContainerForItemOverride(DependencyObject, object)

When overridden in a derived class, undoes the effects of the PrepareContainerForItemOverride(DependencyObject, object) method.

protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameter Type Description
element DependencyObject

The container element.

item object

The item.

GetContainerForItemOverride()

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

protected override DependencyObject GetContainerForItemOverride()

Returns

DependencyObject:

The element used to display the specified item.

IsItemItsOwnContainerOverride(object)

Determines whether the specified item is, or is eligible to be, its own item container.

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

The item to check whether it is an item container.

Returns

bool:

true if the item is a MenuItem or a Separator; otherwise, false.

OnCreateAutomationPeer()

Provides an appropriate MenuAutomationPeer implementation for this control, as part of the WPF automation infrastructure.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The type-specific AutomationPeer implementation.

OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs)

Invoked when an unhandled System.Windows.Input.Keyboard.PreviewGotKeyboardFocus 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 OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameter Type Description
e KeyboardFocusChangedEventArgs

The KeyboardFocusChangedEventArgs that contains the event data.

PrepareContainerForItemOverride(DependencyObject, object)

Prepares the specified element to display the specified item.

protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameter Type Description
element DependencyObject

The element used to display the specified item.

item object

The item to display.