I am able to check the menuitem but not able to uncheck and more over it showing previous check in the menuitem. Once I click on the another menuitem it doesn't uncheck the previous menuitem. I'm adding menuitem from code.
private void OnMenuItemClick(object sender, RoutedEventArgs e) { RoutedEventArgs args = e as RoutedEventArgs; MenuItem item = args.OriginalSource as MenuItem; string header = item.Header.ToString(); if (header == "B1") { btnMenu.Content = header; item.IsChecked=true; } else if (header == "A1") { btnMenu.Content = header; item.IsChecked=true; } }
I am applying the same menuitems and its event handler for 4 buttons.So that if i select one menuitem for first button it will show check on menuitem,the checked menu item show appear when i click on second button.how can i achieve this?..Any suggestion.