BarPopupButtonBase Class
Represents an abstract base class for a popup button control that displays a menu.
[TemplatePart(Name = "PART_IndicatorArea", Type = typeof(UIElement))]
[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 RibbonGalleryMoreButton RibbonGroupOverflowButton RibbonOptionsButton RibbonQuickAccessToolBarCustomizeButton RibbonTabItemOverflowButton RibbonApplicationButton
- Implements:
- IPopupAnchor
Constructors
BarPopupButtonBase()
Initializes a new instance of the BarPopupButtonBase class.
protected BarPopupButtonBase()
Properties
CanEffectivelyExecute
Gets whether the control can effectively execute the Command.
public bool CanEffectivelyExecute { get; protected set; }
Property Value
CanEffectivelyOpenPopup
Gets whether the control can effectively open its popup.
public bool CanEffectivelyOpenPopup { get; protected set; }
Property Value
- bool:
true
if the control can effectively open its popup; otherwise,false
.
CanFocusSelectedGalleryItemOnPopupOpen
Gets whether the button can focus a selected gallery item when the popup is opened.
protected virtual bool CanFocusSelectedGalleryItemOnPopupOpen { get; }
Property Value
- bool:
true
if the button can focus a selected gallery item when the popup is opened; otherwise,false
.
Command
Gets or sets the ICommand related to this button.
CommandParameter
Gets or sets the parameter for the Command.
CommandTarget
Gets or sets the IInputElement target for the Command.
public IInputElement CommandTarget { get; set; }
Property Value
- IInputElement:
The IInputElement target for the Command.
CornerRadius
Gets or sets the corner radius of the control's border.
public CornerRadius CornerRadius { get; set; }
Property Value
- CornerRadius:
The corner radius of the control's border.
HasDropShadow
Gets or sets whether the popup has a drop shadow.
public bool HasDropShadow { get; set; }
Property Value
- bool:
true
if the popup has a drop shadow; otherwise,false
. The default value istrue
.
HasLabel
Gets 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:
true
if the element is enabled; otherwise,false
.
IsPopupOpen
Gets or sets whether the popup is currently open.
public bool IsPopupOpen { get; set; }
Property Value
- bool:
true
if the popup is currently open; otherwise,false
. The default value isfalse
.
IsPressed
Gets or sets whether the control is currently pressed.
public bool IsPressed { get; protected set; }
Property Value
- bool:
true
if the control is currently pressed; otherwise,false
. The default value isfalse
.
KeyTipText
Gets or sets the key tip text used to access the control.
[Localizability(LocalizationCategory.Label)]
public string KeyTipText { get; set; }
Property Value
- 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
- string:
The text label to display.
ParentGalleryMinWidth
Gets or sets the parent gallery's minimum width.
public double ParentGalleryMinWidth { get; protected set; }
Property Value
- double:
The parent gallery's minimum width.
PopupAnimation
Gets or sets the PopupAnimation to use in the popup.
public PopupAnimation PopupAnimation { get; set; }
Property Value
- PopupAnimation:
The PopupAnimation to use in the popup.
PopupBackground
Gets or sets the Brush for the popup's background.
public Brush PopupBackground { get; set; }
Property Value
PopupBorderBrush
Gets or sets the Brush for the popup's border.
PopupBorderThickness
Gets or sets the Thickness of the popup's border.
public Thickness PopupBorderThickness { get; set; }
Property Value
PopupCornerRadius
Gets or sets the CornerRadius of the popup's border.
public CornerRadius PopupCornerRadius { get; set; }
Property Value
- CornerRadius:
The CornerRadius of the popup's border.
PopupHorizontalOffset
Gets or sets the horizontal offset of the popup.
public double PopupHorizontalOffset { get; set; }
Property Value
- double:
The horizontal offset of the popup.
PopupIndicatorTemplate
Gets or sets the DataTemplate for the popup indicator.
public DataTemplate PopupIndicatorTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate for the popup indicator.
PopupOpeningCommand
Gets or sets the ICommand that executes before the button's popup is opened, allowing its items to be customized in MVVM scenarios.
public ICommand PopupOpeningCommand { get; set; }
Property Value
PopupPadding
Gets or sets the Thickness of the popup's padding.
public Thickness PopupPadding { get; set; }
Property Value
PopupVerticalOffset
Gets or sets the vertical offset of the popup.
public double PopupVerticalOffset { get; set; }
Property Value
- double:
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:
true
if 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 RoutedEventArgs 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.
OnPopupOpened(RoutedEventArgs)
Occurs when the IsPopupOpen property changes to true
.
protected virtual void OnPopupOpened(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | The RoutedEventArgs 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.
OnPopupOpening(CancelRoutedEventArgs)
Occurs before the IsPopupOpen property changes to true
.
protected virtual void OnPopupOpening(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.
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:
true
if 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
Identifies the CanEffectivelyExecute dependency property. This field is read-only.
public static readonly DependencyProperty CanEffectivelyExecuteProperty
CanEffectivelyOpenPopupProperty
Identifies the CanEffectivelyOpenPopup dependency property. This field is read-only.
public static readonly DependencyProperty CanEffectivelyOpenPopupProperty
CommandParameterProperty
Identifies the CommandParameter dependency property. This field is read-only.
public static readonly DependencyProperty CommandParameterProperty
CommandProperty
Identifies the Command dependency property. This field is read-only.
public static readonly DependencyProperty CommandProperty
CommandTargetProperty
Identifies the CommandTarget dependency property. This field is read-only.
public static readonly DependencyProperty CommandTargetProperty
CornerRadiusProperty
Identifies the CornerRadius dependency property. This field is read-only.
public static readonly DependencyProperty CornerRadiusProperty
HasDropShadowProperty
Identifies the HasDropShadow dependency property. This field is read-only.
public static readonly DependencyProperty HasDropShadowProperty
HasLabelProperty
Identifies the HasLabel dependency property. This field is read-only.
public static readonly DependencyProperty HasLabelProperty
IsPopupOpenProperty
Identifies the IsPopupOpen dependency property. This field is read-only.
public static readonly DependencyProperty IsPopupOpenProperty
IsPressedProperty
Identifies the IsPressed dependency property. This field is read-only.
public static readonly DependencyProperty IsPressedProperty
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
ParentGalleryMinWidthProperty
Identifies the ParentGalleryMinWidth dependency property. This field is read-only.
public static readonly DependencyProperty ParentGalleryMinWidthProperty
PopupAnimationProperty
Identifies the PopupAnimation dependency property. This field is read-only.
public static readonly DependencyProperty PopupAnimationProperty
PopupBackgroundProperty
Identifies the PopupBackground dependency property. This field is read-only.
public static readonly DependencyProperty PopupBackgroundProperty
PopupBorderBrushProperty
Identifies the PopupBorderBrush dependency property. This field is read-only.
public static readonly DependencyProperty PopupBorderBrushProperty
PopupBorderThicknessProperty
Identifies the PopupBorderThickness dependency property. This field is read-only.
public static readonly DependencyProperty PopupBorderThicknessProperty
PopupClosedEvent
Identifies the PopupClosed routed event. This field is read-only.
public static readonly RoutedEvent PopupClosedEvent
PopupCornerRadiusProperty
Identifies the PopupCornerRadius dependency property. This field is read-only.
public static readonly DependencyProperty PopupCornerRadiusProperty
PopupHorizontalOffsetProperty
Identifies the PopupHorizontalOffset dependency property. This field is read-only.
public static readonly DependencyProperty PopupHorizontalOffsetProperty
PopupIndicatorTemplateProperty
Identifies the PopupIndicatorTemplate dependency property. This field is read-only.
public static readonly DependencyProperty PopupIndicatorTemplateProperty
PopupOpenedEvent
Identifies the PopupOpened routed event. This field is read-only.
public static readonly RoutedEvent PopupOpenedEvent
PopupOpeningCommandProperty
Identifies the PopupOpeningCommand dependency property. This field is read-only.
public static readonly DependencyProperty PopupOpeningCommandProperty
PopupOpeningEvent
Identifies the PopupOpening routed event. This field is read-only.
public static readonly RoutedEvent PopupOpeningEvent
PopupPaddingProperty
Identifies the PopupPadding dependency property. This field is read-only.
public static readonly DependencyProperty PopupPaddingProperty
PopupVerticalOffsetProperty
Identifies the PopupVerticalOffset dependency property. This field is read-only.
public static readonly DependencyProperty PopupVerticalOffsetProperty