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.
Example 1: Binding the ShowDialog command the Command property of a Button
<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
RadFilePathPickerCommands.ShowDialog.Execute(null, this.filePathPicker);
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
<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
RadFilePathPickerCommands.Clear.Execute(null, this.filePathPicker);
RadFilePathPickerCommands.Clear.Execute(Nothing, Me.filePathPicker)