# Commands

The **RadFilePathPicker** control provides the following commands through the **RadFilePathPickerCommands** static class: **ShowDialog** and **Clear**.

## ShowDialog command

The **ShowDialog** command can be set to the Command property of another element such as a Button or it can be executed in code. Both approaches are demonstrated in **Examples 1 and 2**. When executed, it opens a different file dialog depending on the [DialogType](https://www.telerik.com/products/wpf/documentation/controls/radfilepathpicker/features/dialog-types).

**Example 1: Binding the ShowDialog command the Command property of a Button**

```XAML
<StackPanel xmlns:fileDialogs="clr-namespace:Telerik.Windows.Controls.FileDialogs;assembly=Telerik.Windows.Controls.FileDialogs">

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

    <Button Content="Show Dialog" Command="{x:Static fileDialogs:RadFilePathPickerCommands.ShowDialog}" CommandTarget="{Binding ElementName=filePathPicker}" />
</StackPanel>
```

**Example 2: Executing the ShowDialog command in code**

```C#
RadFilePathPickerCommands.ShowDialog.Execute(null, this.filePathPicker);
```

```VB.NET
RadFilePathPickerCommands.ShowDialog.Execute(Nothing, Me.filePathPicker)
```

## Clear command

The **Clear** command can be set to the Command property of another element such as a Button or it can be executed in code. Both approaches are demonstrated in **Examples 3 and 4**. When executed, it clears the Text of the control.

**Example 3: Binding the Clear command the Command property of a Button**

```XAML
<StackPanel xmlns:fileDialogs="clr-namespace:Telerik.Windows.Controls.FileDialogs;assembly=Telerik.Windows.Controls.FileDialogs">

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

    <Button Content="Clear" Command="{x:Static fileDialogs:RadFilePathPickerCommands.Clear}" CommandTarget="{Binding ElementName=filePathPicker}" />
</StackPanel>
```

**Example 4: Executing the Clear command in code**

```C#
RadFilePathPickerCommands.Clear.Execute(null, this.filePathPicker);
```

```VB.NET
RadFilePathPickerCommands.Clear.Execute(Nothing, Me.filePathPicker)
```

## See Also

* [Dialog Types](https://www.telerik.com/products/wpf/documentation/controls/radfilepathpicker/features/dialog-types)
* [Events](https://www.telerik.com/products/wpf/documentation/controls/radfilepathpicker/events)
