title: How to bind a command inside style in WP8?
body: <p>I need to bind a command inside the  style of a button, I tried using following code but it's not working</p>
  
  <pre><code>     &lt;Style x:Key="Button_ML" TargetType="Button"&gt;  
       &lt;Setter Property="HorizontalAlignment" Value="Stretch"/&gt; 
       &lt;Setter Property="Command" Value="{Binding DataContext.ButtonClickCommand,RelativeSource={RelativeSource Mode=Self},ElementName=grdSearch}"/&gt;      
        &lt;Setter Property="CommandParameter" Value="{Binding Content, RelativeSource={RelativeSource Self}}"&gt;  
    &lt;/Style&gt;
  </code></pre>
  
  <p>ViewModel:</p>
  
  <pre><code>        private RelayCommand&lt;string&gt; _buttonClickCommand;
          public RelayCommand&lt;string&gt; ButtonClickCommand
          {
              get
              {
                  return this._buttonClickCommand = new RelayCommand&lt;string&gt;((value) =&gt; this.ClickButton(value));
              }
          }
  
          private void ClickButton(string text)
          {
              if (text.Equals("Space"))
              {
              }
              else
              {
                  this.Text += text;
              }
          }
  </code></pre>