New to Telerik UI for WPF? Download free 30-day trial

IconTemplateSelector

The RadFilePathPicker control exposes an IconTemplateSelector, which allows you to easily change the displayed icon depending on the FilePath.

FilePathPickerIconTemplateSelector

The default value of the IconTemplateSelector property of the control is an instance of FilePathPickerIconTemplateSelector. It exposes the following properties:

  • EmptyTemplate

    The EmptyTemplate is displayed, when the FilePath property of the control is null or empty as demonstrated in Figure 1.

    Figure 1: FilePathPickerIconTemplateSelector EmptyTemplate

    FilePathPickerIconTemplateSelector EmptyTemplate

  • NonEmptyTemplate

    The NonEmptyTemplate is displayed, when the FilePath property of the control is not empty as demonstrated in Figure 2.

    Figure 2: FilePathPickerIconTemplateSelector NonEmptyTemplate

    FilePathPickerIconTemplateSelector NonEmptyTemplate

In order to hide the icon, you can set the IconVisibility property of the control to Collapsed.

Custom FilePathPickerIconTemplateSelector

Example 1 demonstrates how to create a custom FilePathPickerIconTemplateSelector and display red/green Rectangle elements depending on whether the FilePath is empty.

Example 1: Custom FilePathPickerIconTemplateSelector

<StackPanel> 
    <StackPanel.Resources> 
        <DataTemplate x:Key="MyEmptyTemplate"> 
            <Rectangle Fill="Red" /> 
        </DataTemplate> 
 
        <DataTemplate x:Key="MyNonEmptyTemplate"> 
            <Rectangle Fill="Green" /> 
        </DataTemplate> 
        <telerik:FilePathPickerIconTemplateSelector x:Key="MyItemTemplateSelector" EmptyTemplate="{StaticResource MyEmptyTemplate}" NonEmptyTemplate="{StaticResource MyNonEmptyTemplate}" /> 
    </StackPanel.Resources> 
    <telerik:RadFilePathPicker IconTemplateSelector="{StaticResource MyItemTemplateSelector}" /> 
</StackPanel> 

Figure 3: Custom FilePathPickerIconTemplateSelector EmptyTemplate

Custom FilePathPickerIconTemplateSelector EmptyTemplate

Figure 4: Custom FilePathPickerIconTemplateSelector NonEmptyTemplate

Custom FilePathPickerIconTemplateSelector NonEmptyTemplate

See Also

In this article