In This Article

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, DUCE.IResource, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IHaveResources, IQueryAmbient, IAddChild, IGeneratorHost, IContainItemStorage, ICommandSource, IPopupAnchor
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.Primitives.MenuBase System.Windows.Controls.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

CanFocusSelectedGalleryItemOnPopupOpen

Gets whether the button can focus a selected gallery item when the popup is opened.

protected virtual bool CanFocusSelectedGalleryItemOnPopupOpen { get; }

Property Value

System.Boolean:

true if the button can focus a selected gallery item when the popup is opened; otherwise, false.

Command

Gets or sets the System.Windows.Input.ICommand related to this button.

public ICommand Command { get; set; }

Property Value

System.Windows.Input.ICommand:

The System.Windows.Input.ICommand related to this button.

CommandParameter

Gets or sets the parameter for the Command.

public object CommandParameter { get; set; }

Property Value

System.Object:

The parameter for the Command.

CommandTarget

Gets or sets the System.Windows.IInputElement target for the Command.

public IInputElement CommandTarget { get; set; }

Property Value

System.Windows.IInputElement:

The System.Windows.IInputElement target for the Command.

CornerRadius

Gets or sets the corner radius of the control's border.

public CornerRadius CornerRadius { get; set; }

Property Value

System.Windows.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

System.Boolean:

true if the popup has a drop shadow; otherwise, false. The default value is true.

HasLabel

Gets whether the control has a Label available.

public bool HasLabel { get; }

Property Value

System.Boolean:

true if the control has a Label available; otherwise, false. The default value is false.

IsPopupOpen

Gets or sets whether the popup is currently open.

public bool IsPopupOpen { get; set; }

Property Value

System.Boolean:

true if the popup is currently open; otherwise, false. The default value is false.

IsPressed

Gets or sets whether the control is currently pressed.

public bool IsPressed { get; protected set; }

Property Value

System.Boolean:

true if the control is currently pressed; otherwise, false. The default value is false.

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.

ParentGalleryMinWidth

Gets or sets the parent gallery's minimum width.

public double ParentGalleryMinWidth { get; protected set; }

Property Value

System.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

System.Windows.Controls.Primitives.PopupAnimation:

The PopupAnimation to use in the popup.

PopupBackground

Gets or sets the System.Windows.Media.Brush for the popup's background.

public Brush PopupBackground { get; set; }

Property Value

System.Windows.Media.Brush:

The System.Windows.Media.Brush for the popup's background.

PopupBorderBrush

Gets or sets the System.Windows.Media.Brush for the popup's border.

public Brush PopupBorderBrush { get; set; }

Property Value

System.Windows.Media.Brush:

The System.Windows.Media.Brush for the popup's border.

PopupBorderThickness

Gets or sets the System.Windows.Thickness of the popup's border.

public Thickness PopupBorderThickness { get; set; }

Property Value

System.Windows.Thickness:

The System.Windows.Thickness of the popup's border.

PopupCornerRadius

Gets or sets the CornerRadius of the popup's border.

public CornerRadius PopupCornerRadius { get; set; }

Property Value

System.Windows.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

System.Double:

The horizontal offset of the popup.

PopupIndicatorTemplate

Gets or sets the System.Windows.DataTemplate for the popup indicator.

public DataTemplate PopupIndicatorTemplate { get; set; }

Property Value

System.Windows.DataTemplate:

The System.Windows.DataTemplate for the popup indicator.

PopupOpeningCommand

Gets or sets the System.Windows.Input.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

System.Windows.Input.ICommand:

The System.Windows.Input.ICommand that executes before the button's popup is opened, allowing its items to be customized in MVVM scenarios.

PopupPadding

Gets or sets the System.Windows.Thickness of the popup's padding.

public Thickness PopupPadding { get; set; }

Property Value

System.Windows.Thickness:

The System.Windows.Thickness of the popup's padding.

PopupVerticalOffset

Gets or sets the vertical offset of the popup.

public double PopupVerticalOffset { get; set; }

Property Value

System.Double:

The vertical offset of the popup.

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.

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

System.Windows.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 System.Windows.Input.MouseButtonEventArgs

A System.Windows.Input.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 System.Object

The item to check whether it is an item container.

Returns

System.Boolean:

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

IsOverButtonArea(MouseEventArgs)

Returns whether the pointer is over the control's button area.

protected bool IsOverButtonArea(MouseEventArgs e)
Parameter Type Description
e System.Windows.Input.MouseEventArgs

The System.Windows.Input.MouseEventArgs to examine.

Returns

System.Boolean:

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 System.Windows.RoutedEventArgs

The System.Windows.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 System.Windows.Input.MouseButtonEventArgs

The System.Windows.Input.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 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

A System.Windows.Input.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 System.Windows.RoutedEventArgs

The System.Windows.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 System.Windows.RoutedEventArgs

The System.Windows.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 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 System.Windows.Input.KeyEventArgs

The System.Windows.Input.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 System.Windows.DependencyObject

The element used to display the specified item.

item System.Object

The item to display.

SetFocusForIndicatorAreaMouseDown()

Sets focus in response to an indicator area mouse down.

protected virtual bool SetFocusForIndicatorAreaMouseDown()

Returns

System.Boolean:

true if focus was set; otherwise, false.

Events

PopupClosed

Occurs when the IsPopupOpen property changes to false.

public event RoutedEventHandler PopupClosed

Event Type

System.Windows.RoutedEventHandler

PopupOpened

Occurs when the IsPopupOpen property changes to true.

public event RoutedEventHandler PopupOpened

Event Type

System.Windows.RoutedEventHandler

PopupOpening

Occurs before the IsPopupOpen property changes to true.

public event EventHandler<CancelRoutedEventArgs> PopupOpening

Event Type

System.EventHandler<CancelRoutedEventArgs>

Explicit Interface Implementations

IPopupAnchor.IsKeyboardFocusWithinPopup

Gets whether keyboard focus is within the child popup.

bool IPopupAnchor.IsKeyboardFocusWithinPopup { get; }

Returns

System.Boolean:

true if keyboard focus is within the child popup; otherwise, false.

IPopupAnchor.PopupChild

Gets the child element within the popup.

UIElement IPopupAnchor.PopupChild { get; }

Returns

System.Windows.UIElement:

The child element within the popup.

IPopupAnchor.PopupMenu

Gets the popup menu displayed by the popup anchor.

ContextMenu IPopupAnchor.PopupMenu { get; }

Returns

System.Windows.Controls.ContextMenu:

The popup menu displayed by the popup anchor.

IPopupAnchor.PopupStaysOpen

Gets whether the popup stays open, even when the popup loses focus, until explicitly closed.

bool IPopupAnchor.PopupStaysOpen { get; }

Returns

System.Boolean:

true if the popup stays open, even when the popup loses focus, until explicitly closed.

IPopupAnchor.SupportsAltDownToOpen

Gets whether the element supports pressing Alt+Down to open the popup.

bool IPopupAnchor.SupportsAltDownToOpen { get; }

Returns

System.Boolean:

true if the element supports pressing Alt+Down to open the popup; otherwise, false.

IPopupAnchor.WasPopupOpenedWithKeyboard

Gets or sets whether the child popup was opened via the keyboard.

bool IPopupAnchor.WasPopupOpenedWithKeyboard { get; set; }

Returns

System.Boolean:

true if the child popup was opened via the keyboard; otherwise, false.

Fields

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

Inherited Members

  • System.Object.ToString()
  • 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