ExplorerControl - Restrict browsing to specific folder and its subfolders.

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

    Posted 09 May Link to this post


    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.


  2. Answer
    Martin Ivanov
    Martin Ivanov avatar
    2217 posts

    Posted 14 May 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.

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