/// <summary> /// A BreadcrumbItem needs to populate it's Items. This can be due to the fact that a new BreadcrumbItem is selected, and thus /// it's Items must be populated to determine whether this BreadcrumbItem show a dropdown button, /// or when the Path property of the BreadcrumbBar is changed and therefore the Breadcrumbs must be populated from the new path. /// </summary> private void BreadcrumbBar_PopulateItems(object sender, Odyssey.Controls.BreadcrumbItemEventArgs e) { BreadcrumbItem item = e.Item; if (item.Items.Count == 0) { PopulateFolders(item); e.Handled = true; } }
/// <summary> /// The dropdown menu of a BreadcrumbItem was pressed, so delete the current folders, and repopulate the folders /// to ensure actual data. /// </summary> private void bar_BreadcrumbItemDropDownOpened(object sender, BreadcrumbItemEventArgs e) { BreadcrumbItem item = e.Item; // only repopulate, if the BreadcrumbItem is dynamically generated which means, item.Data is a pointer to itself: if (!(item.Data is BreadcrumbItem)) { item.Items.Clear(); PopulateFolders(item); } }
/// <summary> /// A BreadcrumbItem needs to populate it's Items. This can be due to the fact that a new BreadcrumbItem is selected, and thus /// it's Items must be populated to determine whether this BreadcrumbItem show a dropdown button, /// or when the Path property of the BreadcrumbBar is changed and therefore the Breadcrumbs must be populated from the new path. /// </summary> private void BreadcrumbBar_PopulateItems(object sender, Odyssey.Controls.BreadcrumbItemEventArgs e) { BreadcrumbItem item = e.Item; BrowsingFile fse = item.Data as BrowsingFile; if (item.Data == root) { if (item.Items.Count == 0) { foreach (var i in Model.Root) { item.Items.Add(i); } } return; } if (item.Items.Contains(fake) || item.Items.Count == 0) { if (fse == root) { if (fse.IsPopulated) { item.Items.Clear(); foreach (var i in root.Folders) { item.Items.Add(i); } } else { //Add a fake one so we get the selection image item.Items.Add(fake); } } else { if (fse.IsPopulated) { item.Items.Clear(); foreach (var i in fse.Folders) { item.Items.Add(i); } } else { //Add a fake one so we get the selection image item.Items.Add(fake); } } } }
/// <summary> /// Occurs when the dropdown of a BreadcrumbItem is closed. /// </summary> protected virtual void OnBreadcrumbItemDropDownClosed(RoutedEventArgs e) { BreadcrumbItemEventArgs args = new BreadcrumbItemEventArgs(e.Source as BreadcrumbItem, BreadcrumbItemDropDownClosedEvent); RaiseEvent(args); }
/// <summary> /// Occurs before acessing the Items property of a BreadcrumbItem. This event can be used to populate the Items on demand. /// </summary> protected virtual void OnPopulateItems(BreadcrumbItem item) { BreadcrumbItemEventArgs args = new BreadcrumbItemEventArgs(item, BreadcrumbBar.PopulateItemsEvent); RaiseEvent(args); }