title: Binding two commands to one button?
body: <p>I have a tab control contains two tabs, one shows me the messages of a running process and the other shows me a web page!</p>
  
  <p>I have three buttons (start, stop and clear)
  when I press start the process run and the messages show up.</p>
  
  <p>What I need is wen I press Start button, both tabs, shows me the required content. That's mean I need two bind two commands to the same button</p>
  
  <p>Do you know how to bind for 1 button two commands?</p>
  
  <p>I'm using MVVM, and I'm new in MVVM.</p>
  
  <pre><code>&lt;Button Content="Start" Command="{Binding StartProcess_Command }" Height="25" Width="60" Grid.Row="0" Grid.Column="0" Margin="10"/&gt;
  &lt;Button Content="Stop"  Command="{Binding StopProcess_Command}" Height="25" Width="60" Grid.Row="0" Grid.Column="1" Margin="10"/&gt;
  &lt;Button Content="Clear" Command="{Binding ClearBtn_Command}" Height="25" Width="60" Grid.Row="0" Grid.Column="2" Margin="10"/&gt;
  &lt;telerik:RadTabControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Grid.Row="1" Grid.ColumnSpan="4" Margin="10"&gt;
      &lt;telerik:RadTabItem Header="Maestro" IsSelected="{Binding Path=MaestroSelected}"&gt;
          &lt;ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible"&gt;
              &lt;local:WPFBrowser/&gt;
          &lt;/ScrollViewer&gt;
      &lt;/telerik:RadTabItem&gt;
      &lt;telerik:RadTabItem Header="Messages"&gt;
          &lt;Grid Background="LightGray"&gt;
              &lt;ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible"&gt;
                  &lt;TextBlock TextWrapping="Wrap" Text="{Binding Path=output_process,UpdateSourceTrigger=Default}"/&gt;
              &lt;/ScrollViewer&gt;
          &lt;/Grid&gt;
      &lt;/telerik:RadTabItem&gt;
  &lt;/telerik:RadTabControl &gt;
  </code></pre>
  
  <p>And this is the WPFBrowser.cs code:</p>
  
  <pre><code>         public WPFBrowser()
              {
                  ServerString = "localhost"; //defualt value
                  PortString = "9999"; //default value
                  this.refreshCommand = new Lunch_Maestro.ViewModel.Command(DoRefreshCommand);
                  m_WPFBrowser = new WebBrowser()
                  {
                      HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                      VerticalAlignment = System.Windows.VerticalAlignment.Stretch
                  };
  
                  m_WPFBrowser.Navigated += WPFBrowser_Navigated;
  
                  this.Content = m_WPFBrowser;
              }
  
              private void WPFBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
              {
                  this.HideScriptErrors(m_WPFBrowser, true);
              }
  
  
              /// &lt;summary&gt;
              /// Found this link with interesting scenerios for script erros...
              /// http://social.msdn.microsoft.com/Forums/vstudio/en-US/4f686de1-8884-4a8d-8ec5-ae4eff8ce6db/new-wpf-webbrowser-how-do-i-suppress-script-errors?forum=wpf
              /// &lt;/summary&gt;
              public void HideScriptErrors(WebBrowser wb, bool Hide)
              {
                  FieldInfo fiComWebBrowser = typeof(WebBrowser).GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic);
                  if (fiComWebBrowser == null) return;
  
                  object objComWebBrowser = fiComWebBrowser.GetValue(wb);
  
                  if (objComWebBrowser == null) return;
  
                  objComWebBrowser.GetType().InvokeMember("Silent", BindingFlags.SetProperty, null, objComWebBrowser, new object[] { Hide });
  
              }
  
  
              private void DoRefreshCommand()
              {
                  m_WPFBrowser.Navigate(new Uri("http://" + ServerString + ":" + PortString + "/"));
              }
  
              private bool _maestroSelected;
              public bool MaestroSelected
              {
                  get { return _maestroSelected; }
                  set
                  {
                      _maestroSelected = value;
                      if (_maestroSelected == true)
                          m_WPFBrowser.Navigate(new Uri("http://" + ServerString + ":" + PortString + "/"));
                      OnPropertyChanged("MaestroSelected");
                  }
              }
  
              private readonly WebBrowser m_WPFBrowser;
  
              private string _serverString;
              public string ServerString
              {
                  get { return _serverString; }
                  set
                  {
                      _serverString = value;
                      OnPropertyChanged("ServerString");
                  }
              }
  
              private string _portString;
              public string PortString
              {
                  get { return _portString; }
                  set
                  {
                      _portString = value;
                      OnPropertyChanged("PortString");
                  }
              }
  
              private Lunch_Maestro.ViewModel.Command refreshCommand;
              public Lunch_Maestro.ViewModel.Command RefreshCommand
              {
                  get { return refreshCommand; }
              }
  // and Inotify property changes here
  </code></pre>