In This Article

PopupButtonBase Class

Represents a base class for a button Ribbon control that can display a popup.

[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
[TemplatePart(Name = "PART_ResizeGrip", Type = typeof(Thumb))]
public abstract class PopupButtonBase : ButtonBase, IKeyTipTarget, ILogicalParent, IVariantControl
Inheritance:
object Visual UIElement FrameworkElement Control ControlBase ButtonBase object
Derived:
PopupButton SplitButton
Implements:
IKeyTipTarget ILogicalParent IVariantControl

Constructors

PopupButtonBase()

Initializes an instance of the class.

protected PopupButtonBase()

Properties

AutoDisableWhenPopupContentIsDisabled

Gets or sets whether to auto-disable the popup button when all the items on the PopupContent are disabled.

public bool AutoDisableWhenPopupContentIsDisabled { get; set; }

Property Value

bool:

true if auto-disabling should occur; otherwise, false. The default value is true.

CustomPopupPlacementCallback

Gets or sets a delegate handler method that positions the popup control.

[Bindable(false)]
public CustomPopupPlacementCallback CustomPopupPlacementCallback { get; set; }

Property Value

CustomPopupPlacementCallback:

The CustomPopupPlacementCallback delegate method that provides placement information for the popup control. The default value is null.

IsPopupOpen

Gets or sets whether a child popup is open.

public bool IsPopupOpen { get; set; }

Property Value

bool:

true if the a child popup is open; otherwise, false.

LogicalChildren

Gets an enumerator for logical child elements of this element.

protected override IEnumerator LogicalChildren { get; }

Property Value

IEnumerator:

An enumerator for logical child elements of this element.

PopupContent

Gets or sets the content that is displayed on the popup for the button.

public object PopupContent { get; set; }

Property Value

object:

The content that is displayed on the popup for the button.

Remarks

This can be any object, including panels of multiple controls, however it is generally a Menu.

PopupContentTemplate

Gets or sets the DataTemplate to use for the PopupContent.

public DataTemplate PopupContentTemplate { get; set; }

Property Value

DataTemplate:

The DataTemplate to use for the PopupContent.

Remarks

This property is only really useful if your popup content is a data object and not a UI element.

PopupContentTemplateSelector

Gets or sets the DataTemplateSelector to use for the PopupContent.

public DataTemplateSelector PopupContentTemplateSelector { get; set; }

Property Value

DataTemplateSelector:

The DataTemplateSelector to use for the PopupContent.

Remarks

This property is only really useful if your popup content is a data object and not a UI element.

PopupHasBorder

Gets or sets whether the popup should display a border.

public bool PopupHasBorder { get; set; }

Property Value

bool:

true if the popup should display a border; otherwise, false. The default value is true.

PopupHorizontalOffset

Gets or sets the offset from the left of the area that is specified for the popup control content by a combination of the PopupPlacement, PopupPlacementTarget, and PopupPlacementRectangle properties.

[TypeConverter(typeof(LengthConverter))]
public double PopupHorizontalOffset { get; set; }

Property Value

double:

An offset from the left of the area that is specified for the popup control by a combination of the PopupPlacement, PopupPlacementTarget, and PopupPlacementRectangle properties. The default value is 0.0.

PopupPlacement

Gets or sets the orientation of the popup when the it opens, and specifies the behavior of the popup when it overlaps screen boundaries.

public PlacementMode PopupPlacement { get; set; }

Property Value

PlacementMode:

A PlacementMode enumeration value that determines the orientation of the popup when it opens, and that specifies how it interacts with screen boundaries. The default value is Bottom.

PopupPlacementRectangle

Gets or sets the rectangle relative to which the popup control is positioned when it opens.

public Rect PopupPlacementRectangle { get; set; }

Property Value

Rect:

The rectangle that is used to position the popup control. The default value is null.

PopupPlacementTarget

Gets or sets the element relative to which the popup is positioned when it opens.

public UIElement PopupPlacementTarget { get; set; }

Property Value

UIElement:

The UIElement that is the logical parent of the Popup control. The default value is null.

PopupResizeMode

Gets or sets a ControlResizeMode that specifies the popup's resizing capabilities.

public ControlResizeMode PopupResizeMode { get; set; }

Property Value

ControlResizeMode:

A ControlResizeMode that specifies the popup's resizing capabilities. The default value is ControlResizeMode.None.

PopupVerticalOffset

Gets or sets the offset from the top of the area that is specified for the popup control content by a combination of the PopupPlacement, PopupPlacementTarget, and PopupPlacementRectangle properties.

[TypeConverter(typeof(LengthConverter))]
public double PopupVerticalOffset { get; set; }

Property Value

double:

An offset from the top of the area that is specified for the popup control by a combination of the PopupPlacement, PopupPlacementTarget, and PopupPlacementRectangle properties. The default value is 0.0.

Methods

OnLostMouseCapture(MouseEventArgs)

Called when an element no longer is receiving mouse event messages.

protected override void OnLostMouseCapture(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

The event data for the Mouse.LostMouseCapture event.

OnPopupClosed()

Raises the PopupClosedEvent.

protected virtual void OnPopupClosed()

OnPopupOpened()

Raises the PopupOpenedEvent.

protected virtual void OnPopupOpened()

OnPopupOpening()

Raises the PopupOpeningEvent.

protected virtual bool OnPopupOpening()

Returns

bool:

true if the popup opening should be allowed to open; otherwise, false.

OnVisualParentChanged(DependencyObject)

Invoked when the parent of the element in the visual tree has changed.

protected override void OnVisualParentChanged(DependencyObject oldParent)
Parameter Type Description
oldParent DependencyObject

A System.Windows.DependencyObject that indicates the old visual parent.

Events

PopupClosed

Occurs when the value of the IsPopupOpen property changes from true to false.

public event RoutedEventHandler PopupClosed

Event Type

RoutedEventHandler

PopupOpened

Occurs when the value of the IsPopupOpen property changes from false to true.

public event RoutedEventHandler PopupOpened

Event Type

RoutedEventHandler

PopupOpening

Occurs before the value of the IsPopupOpen property changes from false to true.

public event EventHandler<CancelRoutedEventArgs> PopupOpening

Event Type

EventHandler<CancelRoutedEventArgs>

Fields

AutoDisableWhenPopupContentIsDisabledProperty

Identifies the AutoDisableWhenPopupContentIsDisabled dependency property. This field is read-only.

public static readonly DependencyProperty AutoDisableWhenPopupContentIsDisabledProperty

CustomPopupPlacementCallbackProperty

Identifies the CustomPopupPlacementCallback dependency property. This field is read-only.

public static readonly DependencyProperty CustomPopupPlacementCallbackProperty

IsPopupOpenProperty

Identifies the IsPopupOpen dependency property. This field is read-only.

public static readonly DependencyProperty IsPopupOpenProperty

PopupClosedEvent

Identifies the PopupClosed routed event. This field is read-only.

public static readonly RoutedEvent PopupClosedEvent

PopupContentProperty

Identifies the PopupContent dependency property. This field is read-only.

public static readonly DependencyProperty PopupContentProperty

PopupContentTemplateProperty

Identifies the PopupContentTemplate dependency property. This field is read-only.

public static readonly DependencyProperty PopupContentTemplateProperty

PopupContentTemplateSelectorProperty

Identifies the PopupContentTemplateSelector dependency property. This field is read-only.

public static readonly DependencyProperty PopupContentTemplateSelectorProperty

PopupHasBorderProperty

Identifies the PopupHasBorder dependency property. This field is read-only.

public static readonly DependencyProperty PopupHasBorderProperty

PopupHorizontalOffsetProperty

Identifies the PopupHorizontalOffset dependency property. This field is read-only.

public static readonly DependencyProperty PopupHorizontalOffsetProperty

PopupOpenedEvent

Identifies the PopupOpened routed event. This field is read-only.

public static readonly RoutedEvent PopupOpenedEvent

PopupOpeningEvent

Identifies the PopupOpening routed event. This field is read-only.

public static readonly RoutedEvent PopupOpeningEvent

PopupPlacementProperty

Identifies the PopupPlacement dependency property. This field is read-only.

public static readonly DependencyProperty PopupPlacementProperty

PopupPlacementRectangleProperty

Identifies the PopupPlacementRectangle dependency property. This field is read-only.

public static readonly DependencyProperty PopupPlacementRectangleProperty

PopupPlacementTargetProperty

Identifies the PopupPlacementTarget dependency property. This field is read-only.

public static readonly DependencyProperty PopupPlacementTargetProperty

PopupResizeModeProperty

Identifies the PopupResizeMode dependency property. This field is read-only.

public static readonly DependencyProperty PopupResizeModeProperty

PopupVerticalOffsetProperty

Identifies the PopupVerticalOffset dependency property. This field is read-only.

public static readonly DependencyProperty PopupVerticalOffsetProperty

Inherited Members