title: Pass parameter with a command into the viewmodel
body: <p>I have trouble sending a parameter from my view to my viewmodel.</p>
  
  <p><strong>View.xaml</strong>:</p>
  
  <p>In my view, I have the following:</p>
  
  <pre><code>&lt;TextBox
      MinWidth="70"
      Name="InputId"/&gt;
  
  &lt;Button 
      Command="{Binding ButtonCommand}"
      CommandParameter="{Binding ElementName=InputId}"
      Content="Add"/&gt;
  </code></pre>
  
  <p><strong>View.xaml.cs</strong>:</p>
  
  <pre><code>public MyView()
  {
      InitializeComponent();
  }
  
  public MyView(MyViewModel viewModel) : this()
  {
      DataContext = viewModel;
  }
  </code></pre>
  
  <p><strong>MyViewModel.cs</strong>:</p>
  
  <pre><code>public class MyViewModel : BindableBase
  {
      public ICommand ButtonCommand { get; private set; }
  
      public MyViewModel()
      {
          ButtonCommand = new DelegateCommand(ButtonClick);
      }
  
      private void ButtonClick()
      {
          //Read 'InputId' somehow. 
          //But DelegateCommand does not allow the method to contain parameters.
      }
  }
  </code></pre>
  
  <p>Any suggestions to, how I can pass the <code>InputId</code> when I click the button to my viewmodel?</p>