Class SelectionOverview
The selection overview is an optional part of the button bar and will be used if it is important to see which items are selected. It is only used in combination with buttons.
Inheritance
Implements
Namespace: Sartorius.SAF.Presentation.Controls
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
public class SelectionOverview : MultiSelector, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IContainItemStorage, IAddChild
Remarks
The SelectionView works as a MultiSelector, unselected items are however not shown.
Examples
The following example shows how to configure the SelectionOverview:
<DataTemplate x:Key="SingleSelectionTemplate">
<!-- The bound data is the actual selected item -->
<TextBlock Text="{Binding Name}" />
</DataTemplate>
<DataTemplate x:Key="MultiSelectionTemplate">
<!-- The bound data is the list of selected items -->
<!-- This template shows all selected item names in a horizontal list -->
<ItemsControl ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"
Margin="10 0 0 0" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="ItemTemplate">
<!-- just show names of items in the flyout -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" />
<Button Grid.Column="1"
Style="{DynamicResource ItemResetButton}" />
</Grid>
</DataTemplate>
The following example shows how to change the margin of the flyout container and add a tooltip to the remove button of the selected items:
The following example shows how to add additional buttons to the SelectionOverview. VerticalContentAlignment is set to stretch to allow the buttons to take all the vertical place inside the control:
<DataTemplate x:Key="SingleSelectionTemplateWithButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" />
<Button Grid.Column="1"
Style="{DynamicResource ItemResetButton}" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="MultiSelectionTemplateWithButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ItemsControl ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"
Margin="10 0 0 0" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Grid.Column="1"
Style="{DynamicResource ItemsResetButton}" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="ItemTemplateWithButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" />
<Button Grid.Column="1"
Style="{DynamicResource ItemResetButton}" />
</Grid>
</DataTemplate>
Constructors
View SourceSelectionOverview()
Initializes a new instance of the SelectionOverview class.
Declaration
public SelectionOverview()
Fields
View SourceAllowExpansionProperty
Identifies the AllowExpansion dependency property.
Declaration
public static readonly DependencyProperty AllowExpansionProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
IsExpandedProperty
Identifies the IsExpanded dependency property.
Declaration
public static readonly DependencyProperty IsExpandedProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
IsSelectionCountInformationVisibleProperty
Identifies the IsSelectionCountInformationVisible dependency property.
Declaration
public static readonly DependencyProperty IsSelectionCountInformationVisibleProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
MaxFlyoutHeightProperty
Identifies the MaxFlyoutHeight dependency property.
Declaration
public static readonly DependencyProperty MaxFlyoutHeightProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
MaxSelectionCountProperty
Identifies the MaxSelectionCount dependency property.
Declaration
public static readonly DependencyProperty MaxSelectionCountProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
MultiSelectionHeaderTemplateProperty
Identifies the MultiSelectionHeaderTemplate dependency property.
Declaration
public static readonly DependencyProperty MultiSelectionHeaderTemplateProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
RemoveItemClickEvent
Identifies the RoutedEvent for RemoveItemClick.
Declaration
public static readonly RoutedEvent RemoveItemClickEvent
Field Value
| Type | Description |
|---|---|
| RoutedEvent |
SingleSelectionHeaderTemplateProperty
Identifies the SingleSelectionHeaderTemplate dependency property.
Declaration
public static readonly DependencyProperty SingleSelectionHeaderTemplateProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
VisibleItemCountProperty
Defines the dependency property for the VisibleItemCount property.
Declaration
public static readonly DependencyProperty VisibleItemCountProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
Properties
View SourceAllowExpansion
Gets or sets a value indicating whether the SelectionOverview is currently allowed to expand. The default value is true.
Declaration
public bool AllowExpansion { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
When this is false IsExpanded will always coerce to false and the flyout cannot expand.
When the SelectionOverview is overlayed by an Sartorius.SAF.Effects.IOverlayEffect and OverlayEffect.IsOverlayed
ist true the default style will trigger AllowExpansion to be false and cause the SelectionOverview to collapse while the overlay effect
is active.
IsExpanded
Gets or sets a value indicating whether the SelectionOverview is expanded.
Declaration
public bool IsExpanded { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
If AllowExpansion is false this will always be coerced to false and the SelectionOverview cannot expand.
IsSelectionCountInformationVisible
Gets or sets a value indicating whether the selection count information is visible (e.g. 5/7)
Declaration
public bool IsSelectionCountInformationVisible { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
MaxFlyoutHeight
Gets or sets the maximum height of the flyout.
Declaration
public double MaxFlyoutHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Remarks
If this is not explicitly set it will be coerced according to VisibleItemCount
MaxSelectionCount
Gets or sets the maximum count of selectable items.
Declaration
public int MaxSelectionCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
This is only used when IsSelectionCountInformationVisible is true. It does not actually enforce the maximum selection.
MultiSelectionHeaderTemplate
Gets or sets the DataTemplate shown when multiple items are selected.
Declaration
public DataTemplate MultiSelectionHeaderTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| DataTemplate |
SingleSelectionHeaderTemplate
Gets or sets the DataTemplate shown when one item is selected.
Declaration
public DataTemplate SingleSelectionHeaderTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| DataTemplate |
VisibleItemCount
Gets or sets the count of visible items in the flyout.
Declaration
public int VisibleItemCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
This is used to coerce the value of MaxFlyoutHeight. If MaxFlyoutHeight is set explicitly, the VisibleItemCount has no effect.
Methods
View SourceGetContainerForItemOverride()
Creates or identifies the element that is used to display an item.
Declaration
protected override DependencyObject GetContainerForItemOverride()
Returns
| Type | Description |
|---|---|
| DependencyObject | The element used to display an item. |
Overrides
View SourceIsItemItsOwnContainerOverride(object)
Determines if the specified item is (or is eligible to be) its own ItemContainer.
Declaration
protected override bool IsItemItsOwnContainerOverride(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| object | item | The item. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
View SourceOnApplyTemplate()
Invoked whenever application code or internal processes call ApplyTemplate().
Declaration
public override void OnApplyTemplate()
Overrides
View SourceOnItemsPanelChanged(ItemsPanelTemplate, ItemsPanelTemplate)
Invoked when the ItemsPanel property changes.
Declaration
protected override void OnItemsPanelChanged(ItemsPanelTemplate oldItemsPanel, ItemsPanelTemplate newItemsPanel)
Parameters
| Type | Name | Description |
|---|---|---|
| ItemsPanelTemplate | oldItemsPanel | Old value of the ItemsPanel property. |
| ItemsPanelTemplate | newItemsPanel | New value of the ItemsPanel property. |
Overrides
View SourcePrepareContainerForItemOverride(DependencyObject, object)
Prepares the specified element to display the specified item.
Declaration
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | element | Element used to display the specified item. |
| object | item | Specified item. |
Overrides
Events
View SourceRemoveItemClick
Occurs when the remove item button has been clicked.
Declaration
public event RoutedEventHandler RemoveItemClick
Event Type
| Type | Description |
|---|---|
| RoutedEventHandler |