private void OnSubmenuOpened(object sender, RoutedEventArgs e) { Debug.WriteLine($"{Header} submenu opened"); if (OnSubmenuOpenCommand != null && OnSubmenuOpenCommand.CanExecute(null) && !IsSubmenuPopulated) { OnSubmenuOpenCommand.Execute(null); } }
private void SearchMenuItem_SubmenuOpened(object sender, RoutedEventArgs e) { Debug.WriteLine($"{Header} submenu opened"); // OnInit = true; Debug.WriteLine($"{Header} adding sub menu"); if (OnSubmenuOpenCommand != null && OnSubmenuOpenCommand.CanExecute(null) && !IsSubmenuPopulated) { OnSubmenuOpenCommand.Execute(null); } //var source = this.ItemsSource as ObservableCollection<MenuItemViewModel>; //source.Add(new MenuItemViewModel() { Header = "Add by code"}); //source.Add(new MenuItemViewModel() { Header = "Add by code 2" }); //} }