Class SplitButton
- Namespace
- Tudormobile.Wpf.Controls
- Assembly
- Tudormobile.WpfControls.dll
Represents a button control that provides a primary action and a secondary action to display a user-defined popup. This implementation combines a PushButton with a Popup property than can either be defined as a ContextMenu or as a UIElement which will be contained in a System.Windows.Controls.Popup control. The implementation is designed to work reasonably well in stylized environments without needing to define a new control template.
public class SplitButton : Button, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IAddChild, ICommandSource
- Inheritance
-
SplitButton
- Implements
- Inherited Members
Remarks
The SplitButton control is typically used when a primary action is the most common operation, but additional related actions are also available via a dropdown menu. This control is styled to visually distinguish the primary action from the secondary options.
Properties
Placement
Placement of the Menu or Popup.
public PlacementMode Placement { get; set; }
Property Value
Popup
Content for the popup to be displayed when the dropdown arrow is clicked. This can be a ContextMenu or any UIElement. When a UIElement is provided, it will be hosted within a Popup control. The popup and context menu will be positioned according to the Placement property. The defaut value is (null), which results in no popup (or Glyph) being displayed. Note that the Glyph will also be oriented according the the Placement property.
public UIElement? Popup { get; set; }
Property Value
Methods
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
public override void OnApplyTemplate()
OnClick()
Called when a Button is clicked.
protected override void OnClick()
OnPreviewMouseLeftButtonDown(MouseButtonEventArgs)
Invoked when an unhandled PreviewMouseLeftButtonDown routed 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 OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
eMouseButtonEventArgsThe MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was pressed.
OnRenderSizeChanged(SizeChangedInfo)
Called when the rendered size of a control changes.
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
Parameters
sizeInfoSizeChangedInfoSpecifies the size changes.
OnTemplateChanged(ControlTemplate, ControlTemplate)
Called whenever the control's template changes.
protected override void OnTemplateChanged(ControlTemplate oldTemplate, ControlTemplate newTemplate)
Parameters
oldTemplateControlTemplateThe old template.
newTemplateControlTemplateThe new template.