New to Telerik UI for WPF? Download free 30-day trial

Disable File Rename on Double Click in ExplorerControl

Environment

Product Version 2022.3.1109
Product RadFileDialogs for WPF

Description

How to disable file rename on fast double click in RadFileDialogs ExplorerControl.

Solution

A common behavior on double click is file select and open. In the ExplorerControl there is no file opening, so instead a file renaming action is started when you double click the file. To cancel the file renaming, subscribe to the Renaming event of ExplorerControl and set the Cancel property of the event arguments to true. The double click action can be indicated through the PreviewMouseDoubleClick event of the ExplorerControl.

private bool isDoubleClick = false; 
 
private void ExplorerControl_PreviewMouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) 
{ 
    isDoubleClick = true; 
} 
 
private void ExplorerControl_Renaming(object sender, Telerik.Windows.Controls.FileDialogs.RenamingEventArgs e) 
{ 
    if (e.FileInfo is FileInfoWrapper && this.isDoubleClick) 
    { 
        e.Cancel = true; 
    } 
    isDoubleClick = false; 
} 
In this article