How to add a CheckBox to a Menu Item in WPF

xaml
  1. <MenuItem IsCheckable="True" x:Name="_showSolutionExplorer" Header="Solution Explorer" Click="_showContent_Click"></MenuItem>  

c#
  1. private void _showContent_Click(object sender, RoutedEventArgs e)   
  2. {   
  3.     If ((sender as MenuItem).IsChecked)   
  4.         MessageBox.Show("MenuItem is checked");   
  5.     else   
  6.         MessageBox.Show("MenuItem is not checked");   
  7. }  

No comments:

Post a Comment

Note: only a member of this blog may post a comment.