PopupButton Class
Represents a button control that supports display of popups or context menus, and can render in multiple display modes.
[TemplatePart(Name = "PART_IndicatorArea", Type = typeof(UIElement))]
[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
public class PopupButton : Button, DUCE.IResource, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IHaveResources, IQueryAmbient, IAddChild, ICommandSource, IPopupAnchor
- Inheritance:
- Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control ContentControl ButtonBase Button Object
- Derived:
- BreadcrumbButtonBase
Constructors
PopupButton()
public PopupButton()
Properties
ClosePopupCommand
Gets the ICommand that can close the popup.
public static RoutedCommand ClosePopupCommand { get; }
Property Value
- RoutedCommand:
The ICommand that can close the popup.
DisplayMode
Gets or sets a PopupButtonDisplayMode that describes how the content and popup indicator are rendered.
public PopupButtonDisplayMode DisplayMode { get; set; }
Property Value
- PopupButtonDisplayMode:
A PopupButtonDisplayMode that describes how the content and popup indicator are rendered. The default value is
Merged
.
HasDropShadow
Gets or sets whether the popup will display a drop-shadow effect.
public bool HasDropShadow { get; set; }
Property Value
- Boolean:
true
if the popup will display a drop-shadow effect; otherwise,false
. The default value istrue
.
Remarks
Setting this property to true
has no effect if the SystemParameters.DropShadow
property is false
.
IsAutoFocusOnOpenEnabled
Gets or sets a value indicating whether the popup content will be automatically focused when the popup is opened.
public bool IsAutoFocusOnOpenEnabled { get; set; }
Property Value
- Boolean:
true
if the popup content will be automatically focused when the popup is opened; otherwise,false
. The default value istrue
.
IsPopupOpen
Gets or sets whether the popup is currently displayed.
public bool IsPopupOpen { get; set; }
Property Value
- Boolean:
true
if the popup is currently displayed; otherwise,false
.
IsTransparencyModeEnabled
Gets or sets a value indicating whether transparency mode is enabled, meaning the button has no visible background until the pointer is over it.
public bool IsTransparencyModeEnabled { get; set; }
Property Value
- Boolean:
true
if transparency mode is enabled; otherwise,false
. The default value isfalse
.
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.
PopupAllowsTransparency
Gets or sets a value for the popup's AllowTransparency
property.
public bool PopupAllowsTransparency { get; set; }
Property Value
- Boolean:
true
if transparency is allowed; otherwise,false
. The default value istrue
.
Remarks
When this property is set to false
, interop content will be able to render on the popup.
PopupAnimation
Gets or sets the PopupAnimation for the opening and closing of the associated popup.
public PopupAnimation PopupAnimation { get; set; }
Property Value
- PopupAnimation:
The PopupAnimation for the opening and closing of the associated popup.
PopupBackground
Gets or sets the Brush for the popup's background.
public Brush PopupBackground { get; set; }
Property Value
Remarks
This property is only used when PopupContent is specified.
PopupBorderBrush
Gets or sets the Brush for the popup's border.
public Brush PopupBorderBrush { get; set; }
Property Value
Remarks
This property is only used when PopupContent is specified.
PopupBorderThickness
Gets or sets the Thickness for the popup's border.
public Thickness PopupBorderThickness { get; set; }
Property Value
Remarks
This property is only used when PopupContent is specified.
PopupContent
Gets or sets the content that is displayed on the button's Popup
.
public object PopupContent { get; set; }
Property Value
- Object:
The content that is displayed on the button's
Popup
.
Remarks
This can be any object, including panels of multiple controls. The PopupContentTemplate and/or PopupContentTemplateSelector properties can be used to customize the display of data objects (non-UI elements).
The PopupMenu property takes precedence over this property. Therefore, if PopupMenu is set, this property is ignored.
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 useful if your popup content is a data object and not a UI element.
The PopupMenu property takes precedence over this property. Therefore, if PopupMenu is set, this property is ignored.
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 useful if your popup content is a data object and not a UI element.
The PopupMenu property takes precedence over this property. Therefore, if PopupMenu is set, this property is ignored.
PopupCornerRadius
Gets or sets the CornerRadius for the popup's border.
public CornerRadius PopupCornerRadius { get; set; }
Property Value
- CornerRadius:
The CornerRadius for the popup's border.
Remarks
This property is only used when PopupContent is specified.
PopupHorizontalOffset
Gets or sets the horizontal distance between the target origin and the popup alignment point.
public double PopupHorizontalOffset { get; set; }
Property Value
- Double:
The horizontal distance between the target origin and the popup alignment point. The default value is
0
.
PopupIndicator
Gets or sets the object used in the indicator portion of the PopupButton.
public UIElement PopupIndicator { get; set; }
Property Value
- UIElement:
The object used in the indicator portion.
PopupIndicatorTemplate
Gets or sets the DataTemplate used to present the indicator portion of the PopupButton.
public DataTemplate PopupIndicatorTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate used to present the indicator portion.
PopupIndicatorToolTip
Gets or sets the tool-tip object that is displayed for the popup indicator element.
[Localizability(LocalizationCategory.ToolTip)]
public object PopupIndicatorToolTip { get; set; }
Property Value
- Object:
The tool-tip object that is displayed for the popup indicator element.
PopupMenu
Gets or sets the ContextMenu that is opened by the PopupButton.
public ContextMenu PopupMenu { get; set; }
Property Value
- ContextMenu:
The ContextMenu that is opened by the PopupButton.
Remarks
This property takes precedence over the PopupContent-related properties. Therefore, if this property is set, the PopupContent-related properties are ignored.
PopupMenuDataContext
Gets or sets the the data context for the PopupMenu when it participates in data binding.
public object PopupMenuDataContext { get; set; }
Property Value
- Object:
The object to use as the PopupMenu data context. The default style binds this property to the
PopupButton.DataContext
.
Remarks
The DataContext
property of the PopupMenu is bound to this property, if and only if
the DataContext
property was not already set on the ContextMenu
.
PopupPadding
Gets or sets the Thickness of the popup's padding.
public Thickness PopupPadding { get; set; }
Property Value
Remarks
This property is only used when PopupContent is specified.
PopupVerticalOffset
Gets or sets the vertical distance between the target origin and the popup alignment point.
public double PopupVerticalOffset { get; set; }
Property Value
- Double:
The vertical distance between the target origin and the popup alignment point. The default value is
0
.
StaysOpen
Gets or sets a value that indicates whether the ActiproSoftware.Windows.Controls.PopupButton.Popup closes when the control is no longer in focus.
public bool StaysOpen { get; set; }
Property Value
- Boolean:
true
if the ActiproSoftware.Windows.Controls.PopupButton.Popup closes when the control is no longer in focus; otherwise,false
. The default isfalse
.
Remarks
This property has no effect when using PopupMenu.
Methods
OnApplyTemplate()
Invoked whenever application code or internal processes call ApplyTemplate
.
public override void OnApplyTemplate()
OnClick()
Called the button is clicked.
protected override void OnClick()
OnCreateAutomationPeer()
Returns an AutomationPeer object for this control instance.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
An AutomationPeer instance.
OnKeyDown(KeyEventArgs)
Occurs when a key is pressed.
protected override void OnKeyDown(KeyEventArgs e)
Parameter | Type | Description |
---|---|---|
e | KeyEventArgs | The KeyEventArgs instance containing the event data. |
OnMouseLeftButtonDown(MouseButtonEventArgs)
Occurs when the left mouse button is pressed.
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameter | Type | Description |
---|---|---|
e | MouseButtonEventArgs | The MouseButtonEventArgs instance containing the event data. |
OnMouseLeftButtonUp(MouseButtonEventArgs)
Occurs when the left mouse button is released.
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameter | Type | Description |
---|---|---|
e | MouseButtonEventArgs | The MouseButtonEventArgs instance containing the event data. |
OnMouseWheel(MouseWheelEventArgs)
Occurs when the mouse wheel is rotated.
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameter | Type | Description |
---|---|---|
e | MouseWheelEventArgs | The MouseWheelEventArgs that contains the event data. |
OnPopupClosed(RoutedEventArgs)
Occurs when the IsPopupOpen property changes to false
.
protected virtual void OnPopupClosed(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | The |
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 |
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 |
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.
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
DisplayModeProperty
Identifies the DisplayMode dependency property. This field is read-only.
public static readonly DependencyProperty DisplayModeProperty
HasDropShadowProperty
Identifies the HasDropShadow dependency property. This field is read-only.
public static readonly DependencyProperty HasDropShadowProperty
IsAutoFocusOnOpenEnabledProperty
Identifies the IsAutoFocusOnOpenEnabled dependency property. This field is read-only.
public static readonly DependencyProperty IsAutoFocusOnOpenEnabledProperty
IsPopupOpenProperty
Identifies the IsPopupOpen dependency property. This field is read-only.
public static readonly DependencyProperty IsPopupOpenProperty
IsTransparencyModeEnabledProperty
Identifies the IsTransparencyModeEnabled dependency property. This field is read-only.
public static readonly DependencyProperty IsTransparencyModeEnabledProperty
PopupAllowsTransparencyProperty
Identifies the PopupAllowsTransparency dependency property. This field is read-only.
public static readonly DependencyProperty PopupAllowsTransparencyProperty
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
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
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
PopupIndicatorProperty
Identifies the PopupIndicator dependency property. This field is read-only.
public static readonly DependencyProperty PopupIndicatorProperty
PopupIndicatorTemplateProperty
Identifies the PopupIndicatorTemplate dependency property. This field is read-only.
public static readonly DependencyProperty PopupIndicatorTemplateProperty
PopupIndicatorToolTipProperty
Identifies the PopupIndicatorToolTip dependency property. This field is read-only.
public static readonly DependencyProperty PopupIndicatorToolTipProperty
PopupMenuDataContextProperty
Identifies the PopupMenuDataContext dependency property. This field is read-only.
public static readonly DependencyProperty PopupMenuDataContextProperty
PopupMenuProperty
Identifies the PopupMenu dependency property. This field is read-only.
public static readonly DependencyProperty PopupMenuProperty
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
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
StaysOpenProperty
Identifies the StaysOpen dependency property. This field is read-only.
public static readonly DependencyProperty StaysOpenProperty
Inherited Members
- Object.ToString()
- Object.Equals(Object)
- Object.Equals(Object, Object)
- Object.ReferenceEquals(Object, Object)
- Object.GetHashCode()
- Object.GetType()
- Object.MemberwiseClone()