Class DropDownButton
A ToggleButton which opens a Popup on ClickEvent.
Inheritance
Implements
Namespace: Sartorius.SAF.Presentation.Controls
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
public class DropDownButton : ToggleButton, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IAddChild, ICommandSource
Examples
This example illustrates how to use the DropDownButton with a PopupWidth of 150px and a drop down with two entries placed bottom. Each entry executes its assigned event handler on Click:
<SAF:DropDownButton Width="40"
Height="40"
PopupPlacement="Bottom"
PopupWidth="150">
<SAF:DropDownButtonItem Content="Cut"
Click="OnCutClick" />
<SAF:DropDownButtonItem Content="Copy"
Click="OnCopyClick" />
<SAF:DropDownButtonItem Content="Copy"
Click="OnPasteClick" />
</SAF:DropDownButton>
This example illustrates how to use the DropDownButton with a MaxPopupHeight of 400px and two entries. Each entry executes its assigned ICommand on Click:
<SAF:DropDownButton Width="40"
Height="40"
MaxPopupHeight="400">
<SAF:DropDownButtonItem Content="Cut"
Command="{Binding CutCommand}" />
<SAF:DropDownButtonItem Content="Copy"
Command="{Binding CopyCommand}" />
<SAF:DropDownButtonItem Content="Paste"
Command="{Binding PasteCommand}" />
</SAF:DropDownButton>
This example illustrates how to use the DropDownButton with a bound ItemsSource that contains data objects. The ItemTemplate defines a button template used to display each entry:
<DataTemplate x:Key="DropDownButtonItemTemplate">
<SAF:SplitButtonItem Content="{Binding Name}"
Command="{Binding Command}" />
</DataTemplate>
<SAF:DropDownButton Width="40"
Height="40"
ItemsSource="{Binding Actions}"
ItemTemplate="{StaticResource DropDownButtonItemTemplate}" />
Constructors
View SourceDropDownButton()
Creates a new instance of the DropDownButton class.
Declaration
public DropDownButton()
Fields
View SourceItemTemplateProperty
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 |
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 |
PopupPlacementTargetProperty
Dependency property for the PopupPlacementTarget property.
Declaration
public static readonly DependencyProperty PopupPlacementTargetProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
PopupProperty
Readonly dependency property for the PopupBackground property.
Declaration
public static readonly DependencyProperty PopupProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
PopupWidthProperty
Dependency property for the PopupWidth property.
Declaration
public static readonly DependencyProperty PopupWidthProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
Properties
View SourceItemTemplate
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 DropDownButton.
Declaration
public IList Items { get; }
Property Value
| Type | Description |
|---|---|
| IList |
ItemsSource
Gets or sets a collection used to generate the content of the DropDownButton.
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 |
Popup
Gets the Popup.
Declaration
public Popup Popup { get; protected set; }
Property Value
| Type | Description |
|---|---|
| Popup |
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 |
PopupPlacementTarget
Gets or sets the element relative to which the Popup is positioned when it opens
Declaration
public UIElement PopupPlacementTarget { get; set; }
Property Value
| Type | Description |
|---|---|
| UIElement |
PopupWidth
Gets or sets the width of the Popup.
Declaration
public double PopupWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Methods
View SourceOnApplyTemplate()
Invoked whenever application code or internal processes call ApplyTemplate().
Declaration
public override void OnApplyTemplate()
Overrides
View SourceOnLostKeyboardFocus(KeyboardFocusChangedEventArgs)
Called when an element looses keyboard focus.
Declaration
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyboardFocusChangedEventArgs | e | The event data for the LostKeyboardFocus event. |