BarContextMenu Class
Represents a context menu that can host any bar control.
[TemplatePart(Name = "PART_MiniToolBarPresenter", Type = typeof(ContentPresenter))]
public class BarContextMenu : ContextMenu
- Inheritance:
- object Visual UIElement FrameworkElement Control ItemsControl MenuBase ContextMenu object
Constructors
BarContextMenu()
Initializes an instance of the class.
public BarContextMenu()
Properties
IsMiniToolBarAbove
Indicates whether the mini-toolbar is above the menu.
public bool IsMiniToolBarAbove { get; }
Property Value
- bool:
trueif the mini-toolbar is above the menu; otherwise,false.
MiniToolBar
The MiniToolBar in use.
MiniToolBarContent
The mini-toolbar.
public object? MiniToolBarContent { get; set; }
Property Value
- object:
The mini-toolbar, which can either be a mini-toolbar view model that uses ItemContainerTemplateSelector for its UI, or a MiniToolBar control instance.
MiniToolBarStyle
The Style that targets MiniToolBar and is applied to the instance generated by the MiniToolBarContent property.
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
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
public override void OnApplyTemplate()
OnContextMenuOpening(ContextMenuEventArgs)
Invoked whenever an unhandled ContextMenuOpening routed event reaches this class in its route. Implement this method to add class handling for this event.
protected override void OnContextMenuOpening(ContextMenuEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | ContextMenuEventArgs | The RoutedEventArgs that contains the event data. |
OnCreateAutomationPeer()
Creates and returns a ContextMenuAutomationPeer object for this ContextMenu.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
A ContextMenuAutomationPeer object for this ContextMenu.
OnKeyDown(KeyEventArgs)
Called when a KeyDown event is raised by an object inside the ContextMenu.
protected override void OnKeyDown(KeyEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyEventArgs | The event data for the KeyDown event. |
OnOpened(RoutedEventArgs)
Called when the Opened event occurs.
protected override void OnOpened(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | The event data for the Opened event. |
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 | Element used to display the specified item. |
| item | object | Specified item. |
Fields
IsMiniToolBarAboveProperty
Defines the IsMiniToolBarAbove property.
public static readonly DependencyProperty IsMiniToolBarAboveProperty
MiniToolBarContentProperty
Defines the MiniToolBarContent property.
public static readonly DependencyProperty MiniToolBarContentProperty
MiniToolBarProperty
Defines the MiniToolBar property.
public static readonly DependencyProperty MiniToolBarProperty
MiniToolBarStyleProperty
Defines the MiniToolBarStyle property.
public static readonly DependencyProperty MiniToolBarStyleProperty