title: Toggle button command not executed
body: <p>The problem is this. Let's say I have 3 toggle buttons and I want just one being checked at the time using Command. When one button is checked others should be disabled. (I don't want to use radio buttons).
  So I created this simple code but the strange thing is, that when checked button is clicked commands Execute is not executed (no MessageBox is shown).</p>
  
  <pre><code>&lt;Window x:Class="ToggleButtonsProblem.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="350" Width="525"&gt;
  &lt;StackPanel&gt;
      &lt;ToggleButton Command="{Binding ToggleCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"&gt;A&lt;/ToggleButton&gt;
      &lt;ToggleButton Command="{Binding ToggleCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"&gt;B&lt;/ToggleButton&gt;
      &lt;ToggleButton Command="{Binding ToggleCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"&gt;C&lt;/ToggleButton&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>using System;
  using System.Windows;
  using System.Windows.Input;
  using System.Windows.Controls.Primitives;
  
  namespace ToggleButtonsProblem {
  /// &lt;summary&gt;
  /// Interaction logic for MainWindow.xaml
  /// &lt;/summary&gt;
  public partial class MainWindow : Window {
      public MainWindow() {
          InitializeComponent();
          this.DataContext = new ViewModel();
      }
  }
  
  public class ViewModel {
      public static ICommand ToggleCommand { get { return new ToggleCommand(); } }
  }
  
  public class ToggleCommand : ICommand {
      public static bool isSomeChecked = false;
      public static ToggleButton currentCheckedButton;
  
      public bool CanExecute(object parameter) {
          if (currentCheckedButton == null) return true;
          return (parameter as ToggleButton).IsChecked == true;
      }
  
      public event EventHandler CanExecuteChanged {
          add { CommandManager.RequerySuggested += value; }
          remove { CommandManager.RequerySuggested -= value; }
      }
  
      public void Execute(object parameter) {
          currentCheckedButton = null;
          ToggleButton button = parameter as ToggleButton;
          MessageBox.Show(button.IsChecked.ToString());
          if (button.IsChecked == true) {
              currentCheckedButton = button;
          }
          else {                
              currentCheckedButton = null;
          }
      }
  }
  </code></pre>
  
  <p>}</p>