BarPopupButtonBase Class
Represents an abstract base class for a popup button control that displays a menu.
[TemplatePart(Name = "PART_IndicatorArea", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
[TemplatePart(Name = "PART_PopupContentHost", Type = typeof(ResizablePopupContentHost))]
public abstract class BarPopupButtonBase : Menu, IPopupAnchor
- Inheritance:
- object Visual UIElement FrameworkElement Control ItemsControl MenuBase Menu object
- Derived:
- BarPopupButton BarComboBoxDropDownButton DockableToolBarOptionsButton RibbonGalleryMoreButton RibbonGroupOverflowButton RibbonOptionsButton RibbonQuickAccessToolBarCustomizeButton RibbonTabItemOverflowButton RibbonApplicationButton
- Implements:
- IPopupAnchor
Constructors
BarPopupButtonBase()
Initializes an instance of the class.
protected BarPopupButtonBase()
Properties
CanEffectivelyExecute
Indicates whether the control can effectively execute the Command.
public bool CanEffectivelyExecute { get; protected set; }
Property Value
CanEffectivelyOpenPopup
Indicates whether the control can effectively open its popup.
public bool CanEffectivelyOpenPopup { get; protected set; }
Property Value
- bool:
trueif the control can effectively open its popup; otherwise,false.
CanFocusSelectedGalleryItemOnPopupOpen
Indicates whether the button can focus a selected gallery item when the popup is opened.
protected virtual bool CanFocusSelectedGalleryItemOnPopupOpen { get; }
Property Value
- bool:
trueif the button can focus a selected gallery item when the popup is opened; otherwise,false.
Command
The ICommand related to this button.
CommandParameter
The parameter for the Command.
CommandTarget
The IInputElement target for the Command.
CornerRadius
The corner radius of the control's border.
HasDropShadow
Indicates whether the popup has a drop shadow.
public bool HasDropShadow { get; set; }
Property Value
- bool:
trueif the popup has a drop shadow; otherwise,false. The default value istrue.
HasLabel
Indicates whether the control has a Label available.
public bool HasLabel { get; }
Property Value
IsEnabledCore
Gets a value that becomes the return value of IsEnabled in derived classes.
protected override bool IsEnabledCore { get; }
Property Value
- bool:
trueif the element is enabled; otherwise,false.
IsPopupOpen
Indicates whether the popup is currently open.
public bool IsPopupOpen { get; set; }
Property Value
- bool:
trueif the popup is currently open; otherwise,false. The default value isfalse.
IsPressed
Indicates whether the control is currently pressed.
public bool IsPressed { get; protected set; }
Property Value
- bool:
trueif the control is currently pressed; otherwise,false. The default value isfalse.
KeyTipText
The key tip text used to access the control.
[Localizability(LocalizationCategory.Label)]
public string? KeyTipText { get; set; }
Property Value
Label
The text label to display.
[Localizability(LocalizationCategory.Label)]
public string? Label { get; set; }
Property Value
ParentGalleryMinWidth
The parent gallery's minimum width.
PopupAnimation
The PopupAnimation to use in the popup.
PopupBackground
The Brush for the popup's background.
PopupBorderBrush
The Brush for the popup's border.
PopupBorderThickness
The Thickness of the popup's border.
PopupClosedCommand
The ICommand that executes after the button's popup is closed, allowing its items to be customized in MVVM scenarios.
PopupCornerRadius
The CornerRadius of the popup's border.
PopupHorizontalOffset
The horizontal offset of the popup.
PopupIndicatorTemplate
The DataTemplate for the popup indicator.
PopupOpeningCommand
The ICommand that executes before the button's popup is opened, allowing its items to be customized in MVVM scenarios.
PopupPadding
The Thickness of the popup's padding.
PopupVerticalOffset
The vertical offset of the popup.
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. |
ExecuteClickFromKeyboard()
Executes a click event generated by a keyboard action.
protected virtual void ExecuteClickFromKeyboard()
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.
HandleMouseButton(MouseButtonEventArgs)
Called when any mouse button is pressed or released.
protected override void HandleMouseButton(MouseButtonEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseButtonEventArgs | A MouseButtonEventArgs that contains the event data. |
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
IsOverButtonArea(MouseEventArgs)
Returns whether the pointer is over the control's button area.
protected bool IsOverButtonArea(MouseEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseEventArgs | The MouseEventArgs to examine. |
Returns
- bool:
trueif the pointer is over the control's button area; otherwise,false.
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
public override void OnApplyTemplate()
OnClick(RoutedEventArgs)
Occurs when the button is clicked in an area outside of the popup indicator area.
protected virtual void OnClick(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | The RoutedEventArgs containing data related to this event. |
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.
OnIndicatorAreaMouseDown(MouseButtonEventArgs)
Occurs when a pointer button is pressed over the indicator area.
protected virtual void OnIndicatorAreaMouseDown(MouseButtonEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseButtonEventArgs | The MouseButtonEventArgs containing data related to this event. |
OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)
Responds to a change to the IsKeyboardFocusWithin property.
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | 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 | KeyEventArgs | A KeyEventArgs that contains the event data. |
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. |
OnPopupClosed(RoutedEventArgs)
Occurs when the IsPopupOpen property changes to false.
protected virtual void OnPopupClosed(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | 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.
OnPopupOpened(RoutedEventArgs)
Occurs when the IsPopupOpen property changes to true.
protected virtual void OnPopupOpened(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | 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.
OnPopupOpening(CancelRoutedEventArgs)
Occurs before the IsPopupOpen property changes to true.
protected virtual void OnPopupOpening(CancelRoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | CancelRoutedEventArgs | 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.
OnPreviewKeyUp(KeyEventArgs)
Invoked when an unhandled System.Windows.Input.Keyboard.PreviewKeyUp 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 OnPreviewKeyUp(KeyEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyEventArgs | The KeyEventArgs 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. |
SetFocusForIndicatorAreaMouseDown()
Sets focus in response to an indicator area mouse down.
protected virtual bool SetFocusForIndicatorAreaMouseDown()
Returns
- bool:
trueif focus was set; otherwise,false.
UpdateEnabledProperties()
Updates the CanEffectivelyExecute and CanEffectivelyOpenPopup properties.
protected virtual void UpdateEnabledProperties()
UpdatePopupPlacement()
Updates the popup placement as needed.
protected virtual void UpdatePopupPlacement()
Events
PopupClosed
Occurs when the IsPopupOpen property changes to false.
PopupOpened
Occurs when the IsPopupOpen property changes to true.
PopupOpening
Occurs before the IsPopupOpen property changes to true.
public event EventHandler<CancelRoutedEventArgs> PopupOpening
Event Type
Fields
CanEffectivelyExecuteProperty
Defines the CanEffectivelyExecute property.
public static readonly DependencyProperty CanEffectivelyExecuteProperty
CanEffectivelyOpenPopupProperty
Defines the CanEffectivelyOpenPopup property.
public static readonly DependencyProperty CanEffectivelyOpenPopupProperty
CommandParameterProperty
Defines the CommandParameter property.
public static readonly DependencyProperty CommandParameterProperty
CommandProperty
Defines the Command property.
public static readonly DependencyProperty CommandProperty
CommandTargetProperty
Defines the CommandTarget property.
public static readonly DependencyProperty CommandTargetProperty
CornerRadiusProperty
Defines the CornerRadius property.
public static readonly DependencyProperty CornerRadiusProperty
HasDropShadowProperty
Defines the HasDropShadow property.
public static readonly DependencyProperty HasDropShadowProperty
HasLabelProperty
Defines the HasLabel property.
public static readonly DependencyProperty HasLabelProperty
IsPopupOpenProperty
Defines the IsPopupOpen property.
public static readonly DependencyProperty IsPopupOpenProperty
IsPressedProperty
Defines the IsPressed property.
public static readonly DependencyProperty IsPressedProperty
KeyTipTextProperty
Defines the KeyTipText property.
public static readonly DependencyProperty KeyTipTextProperty
LabelProperty
Defines the Label property.
public static readonly DependencyProperty LabelProperty
ParentGalleryMinWidthProperty
Defines the ParentGalleryMinWidth property.
public static readonly DependencyProperty ParentGalleryMinWidthProperty
PopupAnimationProperty
Defines the PopupAnimation property.
public static readonly DependencyProperty PopupAnimationProperty
PopupBackgroundProperty
Defines the PopupBackground property.
public static readonly DependencyProperty PopupBackgroundProperty
PopupBorderBrushProperty
Defines the PopupBorderBrush property.
public static readonly DependencyProperty PopupBorderBrushProperty
PopupBorderThicknessProperty
Defines the PopupBorderThickness property.
public static readonly DependencyProperty PopupBorderThicknessProperty
PopupClosedCommandProperty
Defines the PopupClosedCommand property.
public static readonly DependencyProperty PopupClosedCommandProperty
PopupClosedEvent
Defines the PopupClosed routed event.
public static readonly RoutedEvent PopupClosedEvent
PopupCornerRadiusProperty
Defines the PopupCornerRadius property.
public static readonly DependencyProperty PopupCornerRadiusProperty
PopupHorizontalOffsetProperty
Defines the PopupHorizontalOffset property.
public static readonly DependencyProperty PopupHorizontalOffsetProperty
PopupIndicatorTemplateProperty
Defines the PopupIndicatorTemplate property.
public static readonly DependencyProperty PopupIndicatorTemplateProperty
PopupOpenedEvent
Defines the PopupOpened routed event.
public static readonly RoutedEvent PopupOpenedEvent
PopupOpeningCommandProperty
Defines the PopupOpeningCommand property.
public static readonly DependencyProperty PopupOpeningCommandProperty
PopupOpeningEvent
Defines the PopupOpening routed event.
public static readonly RoutedEvent PopupOpeningEvent
PopupPaddingProperty
Defines the PopupPadding property.
public static readonly DependencyProperty PopupPaddingProperty
PopupVerticalOffsetProperty
Defines the PopupVerticalOffset property.
public static readonly DependencyProperty PopupVerticalOffsetProperty