Getting Started

This tutorial will walk you through the creation of a sample application that contains a RadFilePathPicker control.

Assembly References

In order to use RadFilePathPicker, you will need to add references to the following assemblies:

  • Telerik.Windows.Controls
  • Telerik.Windows.Controls.Input
  • Telerik.Windows.Controls.Navigation
  • Telerik.Windows.Controls.GridView
  • Telerik.Windows.Controls.FileDialogs
  • Telerik.Windows.Data

You can find the required assemblies for each control from the suite in the Controls Dependencies help article.

Defining RadFilePathPicker

Example 1 demonstrates how you can define a RadFilePathPicker in xaml.

Example 1: Defining RadFilePathPicker

<telerik:RadFilePathPicker x:Name="filePathPicker"  /> 

Figure 1: RadFilePathPicker in the Office2016 theme

RadFilePathPicker Getting started

Even at this point, you are ready to start using the control. The following few sections will demonstrate some of the features of the RadFilePathPicker.

IsReadOnly

By default the RadFilePathPicker is read-only, which means that you cannot input text in the RadWatermarkTextBox inside it. In order to change this, you can set the IsReadOnly property to False as demonstrated in Example 2.

Example 2: Setting the IsReadOnly property

<telerik:RadFilePathPicker IsReadOnly="False"  /> 

Text and FilePath

The RadFilePathPicker control exposes two properties that come in handy for working with input: Text and FilePath. The Text property is updated constantly when the user is typing. The FilePath property is only updated when a valid file path is entered or when one is selected through a file dialog.

ShowDialogButtonContent and ShowDialogButtonTemplate

There are two properties that allow for modifying the appearance of the button on the right side of the control, which opens the dialog. The ShowDialogButtonContent expects a glyph as a value, since the default ShowDialogButtonTemplate contains a RadGlyph. Example 3 demonstrates how to change the default glyph shown in the button.

Example 3: Setting the ShowDialogButtonContent

<telerik:RadFilePathPicker ShowDialogButtonContent="&#xe11f;" /> 

Figure 2: RadFilePathPicker with ShowDialogButtonContent set in the Office2016 theme

RadFilePathPicker with ShowDialogButtonContent

If you don't want to show a RadGlyph in the show dialog button, you can set the ShowDialogButtonTemplate property to a custom DataTemplate. Note, that whatever is set to the ShowDialogButtonContent will be the DataContext inside the ShowDialogButtonTemplate.

Example 4: Setting the ShowDialogButtonTemplate

<StackPanel> 
    <StackPanel.Resources> 
        <DataTemplate x:Key="ShowDialogButtonTemplate"> 
            <TextBlock Text="{Binding}" /> 
        </DataTemplate> 
    </StackPanel.Resources> 
 
    <telerik:RadFilePathPicker ShowDialogButtonContent="Show" ShowDialogButtonTemplate="{StaticResource ShowDialogButtonTemplate}"  /> 
</StackPanel> 

Figure 3: RadFilePathPicker with ShowDialogButtonTemplate set in the Office2016 theme

RadFilePathPicker with ShowDialogButtonTemplate

ClearButtonContent and ClearButtonTemplate

There are two properties that allow for modifying the appearance of the clear button, which is shown when some text is entered. The ClearButtonContent expects a glyph as a value, since the default ClearButtonTemplate contains a RadGlyph. Example 5 demonstrates how to change the default glyph shown in the button.

Example 5: Setting the ClearButtonContent

<telerik:RadFilePathPicker IsReadOnly="False" ClearButtonContent="&#xe11d;" /> 

Figure 4: RadFilePathPicker with ClearButtonContent set in the Office2016 theme

RadFilePathPicker with ClearButtonContent

To avoid showing a RadGlyph in the clear button, you can set the ClearButtonTemplate property to a custom DataTemplate. Note, that whatever is set to the ClearButtonContent will be the DataContext inside the ClearButtonTemplate.

Example 6: Setting the ClearButtonTemplate

<StackPanel> 
    <StackPanel.Resources> 
        <DataTemplate x:Key="ClearButtonTemplate"> 
            <TextBlock Text="{Binding}" /> 
        </DataTemplate> 
    </StackPanel.Resources> 
 
    <telerik:RadFilePathPicker IsReadOnly="False" ClearButtonContent="Clear" ClearButtonTemplate="{StaticResource ClearButtonTemplate}"/> 
</StackPanel> 

Figure 5: RadFilePathPicker with ClearButtonTemplate set in the Office2016 theme

RadFilePathPicker with ClearButtonTemplate

See Also

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