ExplorerControl - Restrict browsing to specific folder and its subfolders.

4 posts, 1 answers
  1. Jared
    Jared avatar
    1 posts
    Member since:
    May 2019

    Posted 09 May 2019 Link to this post

    Hello.

    Our project has a requirement to show an ExplorerControl where navigation is limited to a user-defined folder and its subfolders.  Ideally, the navigation tree's root folder would be the specified folder (instead of the hierarchy from This PC to the target folder).

    Is this functionality possible?

    If there was a cancellable "OnBeforeNavigating" event to prevent navigating to parent folders, that might also be sufficient.

     

    I've gotten close to it by handling the DirectoryRequesting event and cancelling any directories that are not the target folder, a parent folder, or child folder.

    However, this still allows users to browse to parent folders and see the contents.  If I try to cancel the DirectoryRequesting events for the parent folders too, the control stops working.

    We looked into editing the control template, but it proved to be more in-depth than we want to go.

    Thanks!

  2. Answer
    Martin Ivanov
    Admin
    Martin Ivanov avatar
    2511 posts

    Posted 14 May 2019 Link to this post

    Hello Jared,

    There is no convenient event for you scenario. I've logged a feature request about this in the Telerik UI for WPF feedback portal where you can track its status. I also updated your Telerik points.

    Currently, a possible approach that you can try is to show the available directories in the custom places area of the ExplorerControl. And hide the file browser tree control.
    //FindChildByType<T> is an extension method part of Telerik.Windows.Controls namespace.
    private void ExplorerControl_Loaded(object sender, RoutedEventArgs e)
    {
        var explorerControl = (ExplorerControl)sender;
        var navigationTree = explorerControl.FindChildByType<FileBrowserTreeView>();
        navigationTree.Visibility = Visibility.Collapsed;
    }
    However, keep in mind that the breadcrumb part (where you enter the directory path) and the back button will still work.

    Regards,
    Martin Ivanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Petar Mladenov
    Admin
    Petar Mladenov avatar
    3152 posts

    Posted 11 Dec 2019 Link to this post

    Hello Jared,

    I wanted to follow your up on this case. You can download this week's internal build and take advantage of the DirectoryNavigating event. To prevent navigation to folder of branch of folders, you can check the path in the event arguments and set e.Cancel true. If you also need some child folders of *non--navigable" folder not visible in the TreeView, you can use DIrectoryRequesting event. I would appreciate any feedback regarding these events and your scenario. Thank you in advance.

    Regards,
    Petar Mladenov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  4. Joe
    Joe avatar
    93 posts
    Member since:
    Nov 2017

    Posted 31 Jan in reply to Petar Mladenov Link to this post

    I've been using these.  They work well.  They also seem to speed up the loading of the dialog
Back to Top