# Getting Started with WPF FilePathPicker

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

## Adding Telerik Assemblies Using NuGet

To use **RadFilePathPicker** when working with NuGet packages, install the `Telerik.Windows.Controls.FileDialogs.for.Wpf.Xaml` package. The [package name may vary](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/available-packages) slightly based on the Telerik dlls set - [Xaml or NoXaml](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/xaml-vs-noxaml)

Read more about NuGet installation in the [Installing UI for WPF from NuGet Package](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/nuget-installation) article.

> tip With the 2025 Q1 release, the Telerik UI for WPF has a new licensing mechanism. You can learn more about it [here](https://www.telerik.com/products/wpf/documentation/installation/licensing/installing-license-key).

## Adding Assembly References Manually

If you are not using NuGet packages, you can add a reference to the following assemblies:

* **Telerik.Licensing.Runtime**
* **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](https://www.telerik.com/products/wpf/documentation/common-information/installation-installing-dependencies-wpf) help article.

## Defining RadFilePathPicker

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

**Example 1: Defining RadFilePathPicker**

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

> caption RadFilePathPicker in the Office2016 theme

![RadFilePathPicker Getting started](https://www.telerik.com/products/wpf/documentation/assets/46966048d8d9bf9ed42739a070542eed/filepathpicker_gettingstarted.png)

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**

```XAML
<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](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/glyphs/common-styles-appearance-glyphs-radglyph). **Example 3** demonstrates how to change the default glyph shown in the button.

**Example 3: Setting the ShowDialogButtonContent**

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

> caption RadFilePathPicker with ShowDialogButtonContent set in the Office2016 theme

![RadFilePathPicker with ShowDialogButtonContent](https://www.telerik.com/products/wpf/documentation/assets/83b329ecb995a0443a37427ce5dfefa2/filepathpicker_gettingstarted_showdialogbuttoncontent.png)

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**

```XAML

<StackPanel>
    <StackPanel.Resources>
        <DataTemplate x:Key="ShowDialogButtonTemplate">
            <TextBlock Text="{Binding}" />
        </DataTemplate>
    </StackPanel.Resources>

    <telerik:RadFilePathPicker ShowDialogButtonContent="Show" ShowDialogButtonTemplate="{StaticResource ShowDialogButtonTemplate}"  />
</StackPanel>
```

> caption RadFilePathPicker with ShowDialogButtonTemplate set in the Office2016 theme

![RadFilePathPicker with ShowDialogButtonTemplate](https://www.telerik.com/products/wpf/documentation/assets/30699881bb5d33809932d13f33943c84/filepathpicker_gettingstarted_showdialogbuttontemplate.png)

## 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](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/glyphs/common-styles-appearance-glyphs-radglyph). **Example 5** demonstrates how to change the default glyph shown in the button.

**Example 5: Setting the ClearButtonContent**

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

> caption RadFilePathPicker with ClearButtonContent set in the Office2016 theme

![RadFilePathPicker with ClearButtonContent](https://www.telerik.com/products/wpf/documentation/assets/5813bfcc975990cdcd42da21ce3b3a2b/filepathpicker_gettingstarted_clearbuttoncontent.png)

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**

```XAML

<StackPanel>
    <StackPanel.Resources>
        <DataTemplate x:Key="ClearButtonTemplate">
            <TextBlock Text="{Binding}" />
        </DataTemplate>
    </StackPanel.Resources>

    <telerik:RadFilePathPicker IsReadOnly="False" ClearButtonContent="Clear" ClearButtonTemplate="{StaticResource ClearButtonTemplate}"/>
</StackPanel>
```

> caption RadFilePathPicker with ClearButtonTemplate set in the Office2016 theme

![RadFilePathPicker with ClearButtonTemplate](https://www.telerik.com/products/wpf/documentation/assets/76934af321cfe79f40ca484a614cf3b2/filepathpicker_gettingstarted_clearbuttontemplate.png)

## Setting FilePath on Drop

Since the **2020.1.316** internal build version, the RadFilePathPicker automatically sets its **FilePath** when a file is dropped over it. If multiple files are dropped, the first one will be used. In order to disable this functionality, you can set the **AllowDrop** property of the control to **False**.

> caption Dropping a file over the RadFilePathPicker

![Dropping a file over the RadFilePathPicker](https://www.telerik.com/products/wpf/documentation/assets/bc00748972d90d24b6aaa0d5bb4df168/filepathpicker_gettingstarted_drop.gif)

## Setting a Theme

The controls from our suite support different themes. You can see how to apply a theme different than the default one in the [Setting a Theme](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview) help article.

> important Changing the theme using implicit styles will affect all controls that have styles defined in the merged resource dictionaries. This is applicable only for the controls in the scope in which the resources are merged.

To change the theme, you can follow the steps below:

* Choose between the themes and add reference to the corresponding theme assembly (ex: **Telerik.Windows.Themes.Windows8.dll**). You can see the different themes applied in the **Theming** examples from our [WPF Controls Examples](https://demos.telerik.com/wpf/) application.

* Merge the ResourceDictionaries with the namespace required for the controls that you are using from the theme assembly. For the **RadFilePathPicker**, you will need to merge the following resources:

  * **Telerik.Windows.Controls**
  * **Telerik.Windows.Controls.Input**
  * **Telerik.Windows.Controls.Navigation**
  * **Telerik.Windows.Controls.GridView**
  * **Telerik.Windows.Controls.FileDialogs**

**Example 7** demonstrates how to merge the ResourceDictionaries so that they are applied globally for the entire application.

**Example 7: Merge the ResourceDictionaries**

```XAML
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/System.Windows.xaml"/>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml"/>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.GridView.xaml"/>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.FileDialogs.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>
```

> Alternatively, you can use the theme of the control via the [StyleManager](https://docs.telerik.com/devtools/wpf/styling-and-appearance/stylemanager/common-styling-apperance-setting-theme-wpf).

**Figure 7** shows a **RadFilePathPicker** with the **Windows8** theme applied.

> caption RadFilePathPicker with the Windows8 theme

![RadFilePathPicker with Windows8 theme](https://www.telerik.com/products/wpf/documentation/assets/666462b674fb7ca332c44f8768fd43a4/radfilepathpicker-setting-theme.png)

## Telerik UI for WPF Learning Resources

* [Telerik UI for WPF FilePathPicker Component](https://www.telerik.com/products/wpf/filepathpicker.aspx)
* [Getting Started with Telerik UI for WPF Components](https://www.telerik.com/products/wpf/documentation/getting-started/first-steps-nuget)
* [Telerik UI for WPF Installation](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/installation-guide)
* [Telerik UI for WPF and WinForms Integration](https://www.telerik.com/products/wpf/documentation/common-information/winforms-integration/overview)
* [Telerik UI for WPF Visual Studio Templates](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/visual-studio-templates)
* [Setting a Theme with Telerik UI for WPF](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview)
* [Telerik UI for WPF Virtual Classroom (Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/16/telerik-ui-for-wpf)
* [Telerik UI for WPF License Agreement](https://www.telerik.com/purchase/license-agreement/wpf-dlw-s)

## See Also

* [Commands](https://www.telerik.com/products/wpf/documentation/controls/radfilepathpicker/features/commands)
* [Dialog Types](https://www.telerik.com/products/wpf/documentation/controls/radfilepathpicker/features/dialog-types)
* [WatermarkTextbox Properties](https://www.telerik.com/products/wpf/documentation/controls/radfilepathpicker/features/watermarktextbox-properties)
* [IconTemplateSelector](https://www.telerik.com/products/wpf/documentation/controls/radfilepathpicker/features/icontemplateselector)
