Ejemplo n.º 1
0
 private void OnPageLoaded(object sender, RoutedEventArgs e)
 {
     ObservableCollection<MenuBindingSource> itemsSource = new ObservableCollection<MenuBindingSource>();
     MenuBindingSource menu1 = new MenuBindingSource("Dropdown Menu1");
     MenuBindingSource menu2 = new MenuBindingSource("Dropdown Menu2");
     MenuBindingSource menu3 = new MenuBindingSource("Dropdown Menu3");
     itemsSource.Add(menu1);
     itemsSource.Add(menu2);
     itemsSource.Add(menu3);
     MenuBindingSource submenu1 = new MenuBindingSource("First Level SubMenu1");
     MenuBindingSource submenu2 = new MenuBindingSource("First Level SubMenu2");
     MenuBindingSource submenu3 = new MenuBindingSource("First Level SubMenu3");
     menu1.AddItem(submenu1);
     menu1.AddItem(submenu2);
     menu1.AddItem(submenu3);
     menu2.AddItem(submenu1);
     menu2.AddItem(submenu2);
     menu2.AddItem(submenu3);
     menu3.AddItem(submenu1);
     menu3.AddItem(submenu2);
     menu3.AddItem(submenu3);
     MenuBindingSource subsubmenu1 = new MenuBindingSource("Second Level SubMenu1");
     MenuBindingSource subsubmenu2 = new MenuBindingSource("Second Level SubMenu2");
     submenu1.AddItem(subsubmenu1);
     submenu1.AddItem(subsubmenu2);
     submenu2.AddItem(subsubmenu1);
     submenu2.AddItem(subsubmenu2);
     submenu3.AddItem(subsubmenu1);
     submenu3.AddItem(subsubmenu2);
     this.MainMenu2.ItemsSource = itemsSource;
 }
Ejemplo n.º 2
0
 public bool RemoveItem(MenuBindingSource source)
 {
     if (m_Items != null)
     {
         return m_Items.Remove(source);
     }
     return false;
 }
Ejemplo n.º 3
0
 public void Insert(int index, MenuBindingSource item)
 {
     if (m_Items == null)
         m_Items = new ObservableCollection<MenuBindingSource>();
     m_Items.Insert(index, item);
 }
Ejemplo n.º 4
0
 public void AddItem(MenuBindingSource source)
 {
     if (m_Items == null)
         m_Items = new ObservableCollection<MenuBindingSource>();
     m_Items.Add(source);
 }