BarMenuItem Class
Represents a menu item control, for use within a menu.
[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
[TemplatePart(Name = "PART_PopupContentHost", Type = typeof(ResizablePopupContentHost))]
public class BarMenuItem : MenuItem, DUCE.IResource, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IHaveResources, IQueryAmbient, IAddChild, IGeneratorHost, IContainItemStorage, ICommandSource, ISupportsCoerceKeyTipText, ISupportsCoerceLabel
- Inheritance:
- System.Object System.Windows.Threading.DispatcherObject System.Windows.DependencyObject System.Windows.Media.Visual System.Windows.UIElement System.Windows.FrameworkElement System.Windows.Controls.Control System.Windows.Controls.ItemsControl System.Windows.Controls.HeaderedItemsControl MenuItem Object
- Derived:
- BarSplitMenuItem
Constructors
BarMenuItem()
Initializes a new instance of the BarMenuItem class.
public BarMenuItem()
BarMenuItem(String)
Initializes a new instance of the BarMenuItem class with the specified label.
public BarMenuItem(string label)
Parameter | Type | Description |
---|---|---|
label | System.String | The text label to display. |
Properties
CanCloneToRibbonQuickAccessToolBar
Gets or sets whether the control can be cloned to the ribbon quick-access toolbar.
public bool CanCloneToRibbonQuickAccessToolBar { get; set; }
Property Value
- System.Boolean:
true
if the control can be cloned to the ribbon quick-access toolbar; otherwise,false
. The default value istrue
.
CanOpenSubMenu
Gets whether the submenu can be opened.
protected virtual bool CanOpenSubMenu { get; }
Property Value
- System.Boolean:
true
if the submenu can be opened; otherwise,false
.
Description
Gets or sets the extended description of the menu item, displayed in large menu items.
[Localizability(LocalizationCategory.Text)]
public string Description { get; set; }
Property Value
- System.String:
The extended description of the menu item.
See Also
IsInputGestureTextVisible
Gets or sets whether the input gesture text is allowed to be visible in the user interface.
public bool IsInputGestureTextVisible { get; set; }
Property Value
- System.Boolean:
true
if the input gesture text is allowed to be visible in the user interface; otherwise,false
. The default value istrue
.
Key
Gets or sets a string that uniquely identifies the control.
[Localizability(LocalizationCategory.NeverLocalize)]
public string Key { get; set; }
Property Value
- System.String:
A string that uniquely identifies the control.
KeyTipText
Gets or sets the key tip text used to access the control.
[Localizability(LocalizationCategory.Label)]
public string KeyTipText { get; set; }
Property Value
- System.String:
The key tip text used to access the control.
Label
Gets or sets the text label to display.
[Localizability(LocalizationCategory.Label)]
public string Label { get; set; }
Property Value
- System.String:
The text label to display.
LargeImageSource
Gets or sets the System.Windows.Media.ImageSource for a large image, generally 32x32
size.
public ImageSource LargeImageSource { get; set; }
Property Value
- System.Windows.Media.ImageSource:
The System.Windows.Media.ImageSource for a large image.
PopupOpeningCommand
Gets or sets the System.Windows.Input.ICommand that executes before the menu item's popup is opened, allowing its items to be customized in MVVM scenarios.
public ICommand PopupOpeningCommand { get; set; }
Property Value
- System.Windows.Input.ICommand:
The System.Windows.Input.ICommand that executes before the menu item's popup is opened, allowing its items to be customized in MVVM scenarios.
ScreenTipFooter
Gets or sets the screen tip footer content.
public object ScreenTipFooter { get; set; }
Property Value
- System.Object:
The screen tip footer content.
ScreenTipHeader
Gets or sets the screen tip header content.
public object ScreenTipHeader { get; set; }
Property Value
- System.Object:
The screen tip header content.
SmallImageSource
Gets or sets the System.Windows.Media.ImageSource for a small image, generally 16x16
size.
public ImageSource SmallImageSource { get; set; }
Property Value
- System.Windows.Media.ImageSource:
The System.Windows.Media.ImageSource for a small image.
Title
Gets or sets the string title, which can override the Label when displayed in screen tips and customization UI.
[Localizability(LocalizationCategory.Title)]
public string Title { get; set; }
Property Value
- System.String:
The string title.
UseLargeSize
Gets or sets whether to use a large size.
public bool UseLargeSize { get; set; }
Property Value
- System.Boolean:
true
if a large size should be used; otherwise,false
. The default value isfalse
.
See Also
Methods
ClearContainerForItemOverride(DependencyObject, Object)
When overridden in a derived class, undoes the effects of the System.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(System.Windows.DependencyObject, System.Object) method.
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameter | Type | Description |
---|---|---|
element | System.Windows.DependencyObject | The container element. |
item | System.Object | The item. |
GetContainerForItemOverride()
Creates or identifies the element used to display a specified item.
protected override DependencyObject GetContainerForItemOverride()
Returns
- System.Windows.DependencyObject:
The element used to display a specified item.
IsItemItsOwnContainerOverride(Object)
Determines if the specified item is (or is eligible to be) its own ItemContainer.
protected override bool IsItemItsOwnContainerOverride(object item)
Parameter | Type | Description |
---|---|---|
item | System.Object | Specified item. |
Returns
- System.Boolean:
true if the item is its own ItemContainer; otherwise, false.
OnApplyTemplate()
Called when the template's tree is generated.
public override void OnApplyTemplate()
OnClick()
protected override void OnClick()
OnCreateAutomationPeer()
Provides an appropriate System.Windows.Automation.Peers.MenuItemAutomationPeer implementation for this control, as part of the WPF automation infrastructure.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- System.Windows.Automation.Peers.AutomationPeer:
A System.Windows.Automation.Peers.MenuItemAutomationPeer for this MenuItem.
OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)
Announces that the keyboard is focused on this element.
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Input.KeyboardFocusChangedEventArgs | The event data for the GotFocus event. |
OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)
Called when the focus is no longer on or within a MenuItem.
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.DependencyPropertyChangedEventArgs | The event data for the IsKeyboardFocusWithinChanged event. |
OnKeyDown(KeyEventArgs)
Responds to the KeyDown event.
protected override void OnKeyDown(KeyEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Input.KeyEventArgs | The event data for the KeyDown event. |
OnKeyTipInvoked(KeyTipInvokedEventArgs)
Occurs when the control's key tip is invoked.
protected virtual void OnKeyTipInvoked(KeyTipInvokedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | KeyTipInvokedEventArgs | The KeyTipInvokedEventArgs containing data related to this event. |
OnKeyTipOpening(KeyTipOpeningEventArgs)
Occurs when the control's key tip is opening.
protected virtual void OnKeyTipOpening(KeyTipOpeningEventArgs e)
Parameter | Type | Description |
---|---|---|
e | KeyTipOpeningEventArgs | The KeyTipOpeningEventArgs containing data related to this event. |
OnKeyUp(KeyEventArgs)
Invoked when an unhandled KeyUp 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 OnKeyUp(KeyEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Input.KeyEventArgs | The System.Windows.Input.KeyEventArgs that contains the event data. |
OnLostKeyboardFocus(KeyboardFocusChangedEventArgs)
Invoked when an unhandled LostKeyboardFocus 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 OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Input.KeyboardFocusChangedEventArgs | The System.Windows.Input.KeyboardFocusChangedEventArgs that contains event data. |
OnMouseEnter(MouseEventArgs)
Called whenever the mouse enters a MenuItem.
protected override void OnMouseEnter(MouseEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Input.MouseEventArgs | The event data for the MouseEnter event. |
OnMouseLeave(MouseEventArgs)
Called whenever the mouse leaves a MenuItem.
protected override void OnMouseLeave(MouseEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Input.MouseEventArgs | The event data for the MouseLeave event. |
OnMouseLeftButtonDown(MouseButtonEventArgs)
Called when the left mouse button is pressed.
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Input.MouseButtonEventArgs | The event data for the MouseLeftButtonDown event. |
OnMouseRightButtonDown(MouseButtonEventArgs)
Called when the right mouse button is pressed.
protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Input.MouseButtonEventArgs | The event data for the MouseRightButtonDown event. |
OnMouseRightButtonUp(MouseButtonEventArgs)
Called when the right mouse button is released.
protected override void OnMouseRightButtonUp(MouseButtonEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Input.MouseButtonEventArgs | The event data for the MouseRightButtonUp event. |
OnSubmenuOpening(CancelRoutedEventArgs)
Occurs before the IsSubmenuOpen property changes to true
.
protected virtual void OnSubmenuOpening(CancelRoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | CancelRoutedEventArgs | The CancelRoutedEventArgs that contains the event data. |
Remarks
This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.
OnToolTipOpening(ToolTipEventArgs)
Invoked whenever the ToolTipOpening routed event reaches this class in its route. Implement this method to add class handling for this event.
protected override void OnToolTipOpening(ToolTipEventArgs e)
Parameter | Type | Description |
---|---|---|
e | System.Windows.Controls.ToolTipEventArgs | Provides data about the event. |
PrepareContainerForItemOverride(DependencyObject, Object)
Prepares the specified element to display the specified item.
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameter | Type | Description |
---|---|---|
element | System.Windows.DependencyObject | Element used to display the specified item. |
item | System.Object | Specified item. |
ToString()
Returns the string representation of a System.Windows.Controls.HeaderedItemsControl object.
public override string ToString()
Returns
- System.String:
A string that represents this object.
Events
SubmenuOpening
Occurs before the IsSubmenuOpen property changes to true
.
public event EventHandler<CancelRoutedEventArgs> SubmenuOpening
Event Type
- System.EventHandler<CancelRoutedEventArgs>
Fields
CanCloneToRibbonQuickAccessToolBarProperty
Identifies the CanCloneToRibbonQuickAccessToolBar dependency property. This field is read-only.
public static readonly DependencyProperty CanCloneToRibbonQuickAccessToolBarProperty
DescriptionProperty
Identifies the Description dependency property. This field is read-only.
public static readonly DependencyProperty DescriptionProperty
IsInputGestureTextVisibleProperty
Identifies the IsInputGestureTextVisible dependency property. This field is read-only.
public static readonly DependencyProperty IsInputGestureTextVisibleProperty
KeyProperty
Identifies the Key dependency property. This field is read-only.
public static readonly DependencyProperty KeyProperty
KeyTipTextProperty
Identifies the KeyTipText dependency property. This field is read-only.
public static readonly DependencyProperty KeyTipTextProperty
LabelProperty
Identifies the Label dependency property. This field is read-only.
public static readonly DependencyProperty LabelProperty
LargeImageSourceProperty
Identifies the LargeImageSource dependency property. This field is read-only.
public static readonly DependencyProperty LargeImageSourceProperty
PopupOpeningCommandProperty
Identifies the PopupOpeningCommand dependency property. This field is read-only.
public static readonly DependencyProperty PopupOpeningCommandProperty
ScreenTipFooterProperty
Identifies the ScreenTipFooter dependency property. This field is read-only.
public static readonly DependencyProperty ScreenTipFooterProperty
ScreenTipHeaderProperty
Identifies the ScreenTipHeader dependency property. This field is read-only.
public static readonly DependencyProperty ScreenTipHeaderProperty
SmallImageSourceProperty
Identifies the SmallImageSource dependency property. This field is read-only.
public static readonly DependencyProperty SmallImageSourceProperty
SubmenuOpeningEvent
Identifies the SubmenuOpening routed event. This field is read-only.
public static readonly RoutedEvent SubmenuOpeningEvent
TitleProperty
Identifies the Title dependency property. This field is read-only.
public static readonly DependencyProperty TitleProperty
UseLargeSizeProperty
Identifies the UseLargeSize dependency property. This field is read-only.
public static readonly DependencyProperty UseLargeSizeProperty
Inherited Members
- System.Object.Equals(System.Object)
- System.Object.Equals(System.Object, System.Object)
- System.Object.ReferenceEquals(System.Object, System.Object)
- System.Object.GetHashCode()
- System.Object.GetType()
- System.Object.MemberwiseClone()
Extension Methods
- FrameworkElementExtensions.AnimateDoubleProperty(String, Double, Double, Double, Nullable<Double>, Nullable<Double>)
- FrameworkElementExtensions.BindToProperty(DependencyProperty, Object, String, BindingMode, IValueConverter, Object)
- FrameworkElementExtensions.BindToProperty(DependencyProperty, Object, DependencyProperty, BindingMode, IValueConverter, Object)
- FrameworkElementExtensions.GetCurrentSize()