title: Binding string to a textbox based on which button is clicked
body: <p>I have an editor (textbox) and I'd like to bind different texts to it based on which button is clicked. </p>
  
  <p>I could use a command on the button and pass the string which I'd like to edit through commandparameter and update the string which is bound to the textbox. This will work but it's not going to save the modifications because there is no binding between the text (which was passed through the commandparameter) and the textbox's text.</p>
  
  <p>My question is, how should I implement this bind neatly without accessing the textbox directly from the View Model?</p>
  
  <p>edit: it's probably vague what I'm trying to achieve. I try to clarify it a bit:</p>
  
  <p>So let's say I have several different buttons, if I click one of those, it should bind some string to the editor's textbox, where I can modify it and save it later.</p>
  
  <pre><code>     &lt;Button Content="Edit query" Command="{Binding ShowQueryInEditorCommand}" CommandParameter="{Binding SomeSqlStringToBeEdited}"/&gt;
  
       &lt;Button Content="Edit query" Command="{Binding ShowQueryInEditorCommand}" CommandParameter="{Binding SomeOtherSqlStringToBeEdited}"/&gt;
  </code></pre>
  
  <p>This is what the command will execute:</p>
  
  <pre><code>    public void ShowQueryInEditor(object o)
      {            
          string SqlStatementParam = o as string;
          if (SqlStatementParam != null)
              SQLStatement = SqlStatementParam;            
      }
  </code></pre>
  
  <p>And the editor TextBox itself:</p>
  
  <pre><code>    &lt;TextBox Text="{Binding SQLStatement}"&gt;
  </code></pre>
  
  <p>As you can see, this is very rudimentary as it just sets the SQLStatement string, but there is no bind between them so it cannot reflect the modifications back to SomeSqlStringToBeEdited/SomeOtherSqlStringToBeEdited. This is what I would like to achieve, to bind that string somehow to the textbox when the button is clicked.</p>