How do I disable or remove the New Folder button in OpenFileDialog?
1 Answer, 1 is accepted
0
Dinko | Tech Support Engineer
Telerik team
answered on 24 May 2021, 10:38 AM
Hi Gonzalo,
Thank you for your interest in our FileDialogs for WPF.
You can hide the new folder button by manually set its Visibility property to Collapsed. You can subscribe to the Loaded event of the RadOpenFileDialog. Then you can get the button using our ChildrenOfType<T>() extension method. Check the following code snippet.
privatevoidShowOpenFileDialog()
{
RadOpenFileDialog openFileDialog = new RadOpenFileDialog
{
InitialDirectory = @"C:\Temp\TestFileDialogs"
};
openFileDialog.Loaded += SaveFileDialog_Loaded;
openFileDialog.ShowDialog();
}
privatevoidSaveFileDialog_Loaded(object sender, RoutedEventArgs e)
{
var saveFileDialog = sender as RadOpenFileDialog;
var button = saveFileDialog.ChildrenOfType<RadButton>().FirstOrDefault(x => x.Name == "NewFolderButton");
button.Visibility = Visibility.Collapsed;
}