This is a migrated thread and some comments may be shown as answers.

Few Question on ExplorerControl

2 Answers 207 Views
FileDialogs
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 08 Jun 2020, 10:21 PM

1.  Is there a way that I can set the top level folder they can access. So lets say I have a directory structure  C:\Files\ExplorerFile\Ticket\4\Testing/  I set the explorer to open at C:\Files\ExplorerFile\Ticket\4\  They can navigate down and create new folders but I do not want them to go up past \4.

 

2. The default is set to Move but you can hold ctrl or shift to make it a copy.  Is there a way to set it to default to copy, or turn off the move function?

3. Is there a way to set the control o if you double click a file that it will open rather then right click and open?

2 Answers, 1 is accepted

Sort by
0
Frank
Top achievements
Rank 1
answered on 09 Jun 2020, 04:33 PM

I did find a way to limit the network folder access. Using _DirectoryNavigating event I can check the directory path and can cancel the event if not in the proper folder.

 

0
Nadya | Tech Support Engineer
Telerik team
answered on 11 Jun 2020, 12:08 PM

Hello Frank,

Following your last post, it seems that you have already found the solution to the first of your questions by using the DirectoryNavigating event.  It occurs when the current folder is about to change and you can cancel it if the end-user doesn't have permissions for a specific folder.

According to your second question, if I understand correctly your requirement is to make the default operation when doing drag and drop to be copy instead of move. I would like to note RadFileDialogs internally use the OLE drag-and-drop service which is supported by all WinForms controls. This allows you to grab items (file and folders) and move them to a different location even if you drop items to non-Telerik controls, just like you can in Windows Explorer. 

Usually, Control.DoDragDrop method is called when you are starting the drag operation, e.g. when handling the MouseDown event. It is the place where you specify what parameter to pass to the DoDragDrop method which is actually the object to drag and you can specify one of the DragDropEffects values. DragDropEffects enumeration that represents the final effect that was performed during the drag-and-drop operation. So, currently, if you would like to copy the file when dropping it to another location you should press the Ctrl key as in standard MS controls.

As to your last question, you can achieve opening a file in ExplorerControl when double click on it by handling the ItemMouseDoubleClick event and use a FileInfoWrapper class as shown below:

 public RadForm1()
 {
     InitializeComponent();

     this.explorerControl1.FileBrowserListView.ItemMouseDoubleClick += this.FileBrowserListView_ItemMouseDoubleClick;
 }

 private void FileBrowserListView_ItemMouseDoubleClick(object sender, ListViewItemEventArgs e)
 {
     ListViewDataItem clickedListBoxItem = e.Item;
     if (clickedListBoxItem != null)
     {
         FileInfoWrapper wrapper = clickedListBoxItem.DataBoundItem as FileInfoWrapper;
         if (wrapper != null)
         {
             System.Diagnostics.Process.Start(wrapper.Path);
         }
     }
 }

I hope this helps. Let me know if I can assist you further.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
FileDialogs
Asked by
Frank
Top achievements
Rank 1
Answers by
Frank
Top achievements
Rank 1
Nadya | Tech Support Engineer
Telerik team
Share this question
or