Class SplitButton
A button that offers the possibility to execute a primary action on ClickEvent and many secondary actions that can be accessed through a Popup and then are also executed on ClickEvent.
Inheritance
Implements
Namespace: Sartorius.SAF.Presentation.Controls
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
[TemplatePart(Name = "PART_ContentPresenter", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "PART_DropDownButton", Type = typeof(DropDownButton))]
public class SplitButton : ButtonBase, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IAddChild, ICommandSource
Examples
This example illustrates how to use the SplitButton with a primary action and two secondary actions. All actions invoke their assigned event handler on Click:
<SAF:SplitButton Content="Complete"
Style="{SAF:Style SplitButtonPrimary}"
Click="OnCompleteClick">
<SAF:SplitButtonItem Content="Complete with options"
Click="OnCompleteWithOptionsClick" />
<SAF:SplitButtonItem Content="Abort"
Click="OnAbortClick" />
</SAF:SplitButton>
This example illustrates how to use the SplitButton with a primary action and two secondary actions. All actions execute their assigned ICommand on Click:
<SAF:SplitButton Content="Complete"
Style="{SAF:Style SplitButtonSecondary}"
Command="{Binding CompleteCommand}">
<SAF:SplitButtonItem Content="Complete with options"
Command="{Binding CompleteWithOptionsCommand}" />
<SAF:SplitButtonItem Content="Abort"
Command="{Binding AbortCommand}" />
</SAF:SplitButton>
This example illustrates how to use the SplitButton with a primary action and a bound ItemsSource that contains data objects, each representing a secondary action. The ItemTemplate defines a button template used to display each item:
<DataTemplate x:Key="SplitButtonItemTemplate">
<SAF:SplitButtonItem Content="{Binding Name}"
Command="{Binding Command}" />
</DataTemplate>
<SAF:SplitButton Content="Complete"
Style="{SAF:Style SplitButtonTertiary}"
Command="{Binding CompleteCommand}"
ItemsSource="{Binding Actions}"
ItemTemplate="{StaticResource SplitButtonItemTemplate}" />
Constructors
View SourceSplitButton()
Creates a new instance of the SplitButton class.
Declaration
public SplitButton()
Fields
View SourceIsPopupOpenProperty
Dependency property for the IsPopupOpen property.
Declaration
public static readonly DependencyProperty IsPopupOpenProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
ItemTemplateProperty
Dependency property for the ItemTemplate property.
Declaration
public static readonly DependencyProperty ItemTemplateProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
ItemTemplateSelectorProperty
Dependency property for the ItemTemplateSelector property.
Declaration
public static readonly DependencyProperty ItemTemplateSelectorProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
ItemsProperty
Dependency property for the Items property.
Declaration
public static readonly DependencyProperty ItemsProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
ItemsSourceProperty
Dependency property for the ItemsSource property.
Declaration
public static readonly DependencyProperty ItemsSourceProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
MaxPopupHeightProperty
Dependency property for the MaxPopupHeight property.
Declaration
public static readonly DependencyProperty MaxPopupHeightProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
MouseOverBackgroundProperty
Dependency property for the MouseOverBackground property.
Declaration
public static readonly DependencyProperty MouseOverBackgroundProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
MouseOverForegroundProperty
Dependency property for the MouseOverForeground property.
Declaration
public static readonly DependencyProperty MouseOverForegroundProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
PopupAnimationProperty
Dependency property for the PopupAnimation property.
Declaration
public static readonly DependencyProperty PopupAnimationProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
PopupBackgroundProperty
Dependency property for the PopupBackground property.
Declaration
public static readonly DependencyProperty PopupBackgroundProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
PopupBorderBrushProperty
Dependency property for the PopupBorderBrush property.
Declaration
public static readonly DependencyProperty PopupBorderBrushProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
PopupPlacementProperty
Dependency property for the PopupPlacement property.
Declaration
public static readonly DependencyProperty PopupPlacementProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
PressedBackgroundProperty
Dependency property for the PressedBackground property.
Declaration
public static readonly DependencyProperty PressedBackgroundProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
PressedForegroundProperty
Dependency property for the PressedForeground property.
Declaration
public static readonly DependencyProperty PressedForegroundProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
Properties
View SourceIsPopupOpen
Gets or sets the value that indicates whether the Popup is open.
Declaration
public bool IsPopupOpen { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ItemTemplate
Gets or sets the DataTemplate used to display each item.
Declaration
public DataTemplate ItemTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| DataTemplate |
ItemTemplateSelector
Gets or sets the custom logic for choosing a template used to display each item.
Declaration
public DataTemplateSelector ItemTemplateSelector { get; set; }
Property Value
| Type | Description |
|---|---|
| DataTemplateSelector |
Items
Gets the collection used to generate the content of the SplitButton.
Declaration
public IList Items { get; }
Property Value
| Type | Description |
|---|---|
| IList |
ItemsSource
Gets or sets a collection used to generate the content of the SplitButton.
Declaration
public IEnumerable ItemsSource { get; set; }
Property Value
| Type | Description |
|---|---|
| IEnumerable |
MaxPopupHeight
Gets or sets the maximum height of the Popup.
Declaration
public double MaxPopupHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
MouseOverBackground
Gets or sets the background color of the mouse over state.
Declaration
public Brush MouseOverBackground { get; set; }
Property Value
| Type | Description |
|---|---|
| Brush |
MouseOverForeground
Gets or sets the foreground color of the mouse over state.
Declaration
public Brush MouseOverForeground { get; set; }
Property Value
| Type | Description |
|---|---|
| Brush |
PopupAnimation
Gets or sets the Popup open animation.
Declaration
public PopupAnimation PopupAnimation { get; set; }
Property Value
| Type | Description |
|---|---|
| PopupAnimation |
PopupBackground
Declaration
public Brush PopupBackground { get; set; }
Property Value
| Type | Description |
|---|---|
| Brush |
PopupBorderBrush
Declaration
public Brush PopupBorderBrush { get; set; }
Property Value
| Type | Description |
|---|---|
| Brush |
PopupPlacement
Gets or sets the PlacementMode of the Popup.
Declaration
public PlacementMode PopupPlacement { get; set; }
Property Value
| Type | Description |
|---|---|
| PlacementMode |
PressedBackground
Gets or sets the background color of the pressed state.
Declaration
public Brush PressedBackground { get; set; }
Property Value
| Type | Description |
|---|---|
| Brush |
PressedForeground
Gets or sets the foreground color of the pressed state.
Declaration
public Brush PressedForeground { get; set; }
Property Value
| Type | Description |
|---|---|
| Brush |
Methods
View SourceOnApplyTemplate()
Invoked whenever application code or internal processes call ApplyTemplate().
Declaration
public override void OnApplyTemplate()
Overrides
View SourceOnClick()
Raises the Click routed event.
Declaration
protected override void OnClick()
Overrides
View SourceOnMouseLeftButtonUp(MouseButtonEventArgs)
Invoked when an unhandled MouseLeftButtonUp routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| MouseButtonEventArgs | e | The MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was released. |