Few Question on ExplorerControl

3 posts, 0 answers
  1. Frank
    Frank avatar
    105 posts
    Member since:
    Mar 2012

    Posted 08 Jun Link to this post

    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. Frank
    Frank avatar
    105 posts
    Member since:
    Mar 2012

    Posted 09 Jun Link to this post

    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.

     

  3. Nadya
    Admin
    Nadya avatar
    391 posts

    Posted 11 Jun Link to this post

    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.
Back to Top