ComponentOne Input Library for WPF
Input Library Overview / Multiselect / Work with Multiselect / Header Customization
In This Topic
    Header Customization
    In This Topic

    MultiSelect has customizable header which, by default, it displays up to five selected items from the list and the item count after that. However, you can modify this default behavior by changing how many items appear in the header or using placeholder, based on your requirements. Let us discuss about these header customizations in the following sections.

    Manage the Number of Displayed Items

    MultiSelect allows you to change the maximum number of selected items to be displayed in the header using MaxHeaderItems property of the C1MultiSelect class. For example, when you set the value of MaxHeaderItems property to 3, as soon as you select the fourth item, the header starts showing the total count of selected items as "4 items selected".

    The following image shows how the items in the header appear on setting the MaxHeaderItems property.

    Setting Max Header Items

    To display maximum three items in the header, use the following code:

    <c1:C1MultiSelect x:Name="mselect" MaxHeaderItems="3" Height="100" Width="350" ></c1:C1MultiSelect>
    
    mselect.MaxHeaderItems = 3;
    

    Back to Top

    Use Placeholder

    The placeholder provides contextual clues of what value users should enter in a control. MultiSelect lets you display a placeholder text in the header when nothing is selected or entered in it. You can add a placeholder text to the MultiSelect control header using Placeholder property of the C1MultiSelect class. For example, in the following example, we added "Select Names from the List" as a placeholder text in the header to prompt the user to enter a phone number in it.

    Placeholder used in WPF MultiSelect

    When you click within the control and enter text, you can notice that the Placeholder disappears.

    The following code shows the usage of the Placeholder property to add a placeholder text in the MaskedtextBox control:

    <c1:C1MultiSelect x:Name="mselect" PlaceHolder="Select Names from the List" Height="50" Width="350"></c1:C1MultiSelect>
    
    mselect.PlaceHolder= "Select Names from the List";
    

    Back to Top