Completed
Last Updated: 24 Apr 2018 05:32 by ADMIN
ADMIN
Petar Mladenov
Created on: 09 Oct 2017 10:33
Category: FileDialogs
Type: Feature Request
2
FileDialogs: Make possible to override the ItemsSources of the navigation tree and navigation breadcrumb
Overrideble properties / methods in DialogViewModels could be added to support custom (or filtered) sources of the navigation TreeView and navigation Breadcrumb.

As a temporary solution, users might filter the breadcrumb this way:
 var breadCrumb = (sender as RadOpenFolderDialog).ChildrenOfType<RadBreadcrumb>().LastOrDefault();
            if (breadCrumb != null)
            {
                RadBreadcrumbBarItem bar = breadCrumb.ItemContainerGenerator.ContainerFromIndex(0) as RadBreadcrumbBarItem;

                DirectoryInfoWrapper bDrive = bar.Items.OfType<DirectoryInfoWrapper>().FirstOrDefault(dir => dir.Name.StartsWith("B"));
                bar.Items.Remove(bDrive);

                DirectoryInfoWrapper rDrive = bar.Items.OfType<DirectoryInfoWrapper>().FirstOrDefault(dir => dir.Name.StartsWith("R"));
                bar.Items.Remove(rDrive);
            }

To filter the treeview:

 var tree = (sender as RadOpenFolderDialog).ChildrenOfType<RadTreeView>().LastOrDefault();
            if (tree != null)
            {
                tree.LoadOnDemand += Tree_LoadOnDemand;
            }
   private void Tree_LoadOnDemand(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            RadTreeViewItem clickedItem = e.OriginalSource as RadTreeViewItem;
            List<DirectoryInfoWrapper> dirsToRemove = new List<DirectoryInfoWrapper>();
            foreach (DirectoryInfoWrapper dir in clickedItem.Items.OfType<DirectoryInfoWrapper>())
            {
                // removing drives 'R:' and 'B:' for testing purposes.
                if (dir.Name.StartsWith("R") || dir.Name.StartsWith("B"))
                {
                    dirsToRemove.Add(dir);
                }
            }
            dirsToRemove.ForEach(dir => clickedItem.Items.Remove(dir));
        }
1 comment
ADMIN
Ralitsa
Posted on: 24 Apr 2018 05:31
Hi, 

The feature will be available in our next official version – R2 2018, scheduled for the middle of May.

Best regards,
Ralitsa Kumanova