private void LibraryAdded(object sender, ILibrary library) { MenuItem libraryMenuItem = new MenuItem(); libraryMenuItem.Header = library.GetName(); foreach (Type node in library.GetNodeTypes()) { MenuItem libraryNodeItem = new MenuItem(); libraryNodeItem.Header = node.Name; nodeTypes[libraryNodeItem] = node; libraryNodeItem.Click += new RoutedEventHandler(libraryNodeItem_Click); libraryMenuItem.Items.Add(libraryNodeItem); } Libraries.Items.Add(libraryMenuItem); }
void LibraryAdded(object sender, ILibrary library) { Menu libraryMenu = new Menu(); ToolBar.SetOverflowMode(libraryMenu, OverflowMode.AsNeeded); libraryMenu.Background = new SolidColorBrush(Color.FromRgb((byte)0xBC, (byte)0xC7, (byte)0xD8)); Items.Add(libraryMenu); MenuItem libraryMenuItem = new MenuItem(); libraryMenuItem.Header = library.GetName(); libraryMenu.Items.Add(libraryMenuItem); foreach (Type node in library.GetNodeTypes()) { MenuItem libraryNodeItem = new MenuItem(); libraryNodeItem.Header = node.Name; nodeTypes[libraryNodeItem] = node; libraryNodeItem.Click += new RoutedEventHandler(libraryNodeItem_Click); libraryMenuItem.Items.Add(libraryNodeItem); } }