[]
        
(Showing Draft Content)

Selection

MultiSelect allows you to modify the way of selection of items in multiple ways. Let us explore these ways in the following sections.

Selection Modes

MultiSelect provides SelectionMode property to determine whether you can select one or more than one item from the header. This property lets you choose between the following selection modes through C1SelectionMode enumeration:

  • Single: Allows you to select only one item at a time.
  • Multiple: Allows you to select multiple items without holding down a modifier key.
  • Extended: Allows you to select multiple consecutive items while holding down the corresponding modifier key.
  • None: Does not allow you to select any item.

The following GIF showcases the MultiSelect control with SelectionMode set as Single.

WPF MultiSelect SelectionMode

To set the selection mode to single, use the following code:

xml

<c1:C1MultiSelect x:Name="mselect" SelectionMode="Single" Height="100" Width="350" ></c1:C1MultiSelect>

csharp

mselect.SelectionMode = C1SelectionMode.Single;

Show SelectAll

MultiSelect allows you to select all items from the dropdown list at once simply by setting the ShowSelectAll property to true. Setting this property displays a "SelectAll' check box in the dropdown list of the MultiSelect control as shown in the following image.

WPF MultiSelect showing selectall check box

The following example uses the Products table from NWind to show the list of products in the MultiSelectListBox control.

xml

<c1:C1MultiSelect x:Name="mselect" ShowSelectAll="True" Height="100" Width="350"></c1:C1MultiSelect>

csharp

mselect.ShowSelectAll = true;