Unplanned
Last Updated: 07 May 2024 09:30 by Martin Ivanov
Created by: Martin Ivanov
Comments: 0
Category: FilePathPicker
Type: Feature Request
1

Currently, the RadFilePathPicker control doesn't support pasting paths wrapped in quotation marks. For example: "C:\myfolder\anotherfolder\" instead you should use C:\myfolder\anotherfolder\

Such paths can be typed (or pasted) but this won't update the FilePath value of the control.
One way to create such type of path is via the "Copy as path" option in the Windows Explorer's right click context menu.

Allow paths wrapped in quotation marks, to be placed in the input box without the need to manually remove the quotation. This should update the FilePath properly if the text contains valid file/directory path.

In the meantime, you can use the following customization:

 

public MainWindow()
{
 InitializeComponent();
 DataObject.AddPastingHandler(this.filePathPicker, OnFilePathPickerPaste);            
}

private void OnFilePathPickerPaste(object sender, DataObjectPastingEventArgs e)
{
 var isText = e.SourceDataObject.GetDataPresent(DataFormats.UnicodeText, true);
 if (isText)
 {
	 e.CancelCommand();

	 var text = (string)e.SourceDataObject.GetData(DataFormats.UnicodeText);
	 while (text.Contains('"'))
	 {                    
		 text = text.Replace("\"", string.Empty);
	 }
	 this.filePathPicker.Text = text;
 }
}