void removeItem_Click(object sender, EventArgs e) { IHierarchicalItem item = (IHierarchicalItem)sender; RadMenuItem parentItem = (RadMenuItem)item.ParentItem; parentItem.Items.Remove((RadMenuItem)sender); }
private static string GetPath(IHierarchicalItem item) { var sb = new StringBuilder(); sb.Append(item.Item.Name); if (item.Parent != null) { sb.Insert(0, GetPath(item.Parent) + "/"); } return(sb.ToString()); }
private IHierarchicalItem FindRootHierarchyItem() { for (IHierarchicalItem hierarchyParent = this.hierarchyParent; hierarchyParent != null; hierarchyParent = hierarchyParent.HierarchyParent) { if (hierarchyParent.HierarchyParent == null) { return(hierarchyParent); } } return((IHierarchicalItem)null); }
void addItem_Click(object sender, EventArgs e) { RadMenuItem item = new RadMenuItem(); item.Text = "New " + (sender as RadMenuItem).Text; IHierarchicalItem hItem = (IHierarchicalItem)sender; RadMenuItemBase parentItem = (RadMenuItemBase)hItem.ParentItem; parentItem.Items.Add(item); }
private IHierarchicalItem FindRootHierarchyItem() { IHierarchicalItem current = this.hierarchyParent; while (current != null) { if (current.ParentItem == null) { return(current); } current = current.ParentItem; } return(null); }
private static void CheckTitleChaperMenuItem(IHierarchicalItem item, int currentTitle, int currentChapter) { var parent = item as ParentDataItem <TitleChapterMenuItemData>; if (parent != null) { parent.IsChecked = parent.Data.Title == currentTitle; foreach (var subItem in parent.SubItems) { CheckTitleChaperMenuItem(subItem, currentTitle, currentChapter); } } else { var leaf = (LeafItem <TitleChapterMenuItemData>)item; leaf.IsChecked = leaf.Data.Title == currentTitle && leaf.Data.Chapter == currentChapter; } }