This example demonstrates how to use the WinForms Breadcrumb Editor to create a folder navigation bar inspired by Microsoft Windows File Explorer.
Two root nodes ('Root' and 'Computer') are created at design time. Their BreadCrumbNode.Persistent and BreadCrumbNode.PopulateOnDemand properties are set to true. The Root node stores shortcuts to most important directories (Desktop, Windows, Program Files). The Computer node allows users to quickly navigate through local disks via related shortcuts.
void InitBreadCrumbRootNode(BreadCrumbNode node) {
node.ChildNodes.Add(new BreadCrumbNode("Desktop", Environment.GetFolderPath(Environment.SpecialFolder.Desktop)));
node.ChildNodes.Add(new BreadCrumbNode("Windows", Environment.GetFolderPath(Environment.SpecialFolder.Windows)));
node.ChildNodes.Add(new BreadCrumbNode("Program Files", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)));
}
void InitBreadCrumbComputerNode(BreadCrumbNode node) {
foreach (DriveInfo driveInfo in GetFixedDrives()) {
node.ChildNodes.Add(new BreadCrumbNode(driveInfo.Name, driveInfo.RootDirectory));
}
}
The following events are handled to dynamically generate the Nodes tree according to the folder structure:
(you will be redirected to DevExpress.com to submit your response)