EmptyText

The EmptyText property allows you to specify a string that will be shown when there is no selection.

Example 1: Setting the EmptyText property

<telerik:RadComboBox Width="200" 
                     ItemsSource="12345" 
                     EmptyText="Select an item"> 
</telerik:RadComboBox> 

Figure 1: RadComboBox with IsEditable property set to True and EmptyText in the Office2016 theme

Editable RadComboBox with EmptyText displayed

Figure 2: RadComboBox with IsEditable property set to False(default) and EmptyText in the Office2016 theme

NonEditable RadComboBox with EmptyText displayed

If the IsEditable property of the RadComboBox is set to True and the control has focus the EmptyText is not displayed.

EmptySelectionBoxTemplate

The EmptySelectionBoxTemplate gives you the ability to define a separate DataTemplate to be shown when there is no selected item. Example 2 demonstrates how to create and apply an EmptySelectionBoxTemplate.

Example 2: Set the EmptySelectionBoxTemplate property

<StackPanel> 
    <StackPanel.Resources> 
        <DataTemplate x:Key="EmptyTemplate"> 
            <TextBlock FontWeight="Bold" FontFamily="Comic Sans" FontStyle="Italic" Text="Please select an agency" /> 
        </DataTemplate> 
    </StackPanel.Resources> 
    <telerik:RadComboBox Width="200" 
                         ItemsSource="12345" 
                         EmptySelectionBoxTemplate="{StaticResource EmptyTemplate}"> 
    </telerik:RadComboBox> 
</StackPanel> 

Figure 2: RadComboBox with EmptySelectionBoxTemplate in the Office2016 theme

RadComboBox with EmptySelectionBoxTemplate

The EmptySelectionBoxTemplate property only works if the RadComboBox is in non-editable mode, i.e its IsEditable property is set to False. Otherwise, the EmptyText will be applied.

In this article
Not finding the help you need? Improve this article