title: In WPF, a property should be changed by its name or by use of binding
body: <p>I am new to WPF and a question arose in my mind while I was developing my app.
  Assume that I have a textbox defined as below</p>
  
  <pre><code>&lt;TextBox x:Name="MyTextBox" /&gt;
  </code></pre>
  
  <p>Then in my C# code, I can change the string shown in this textbox using the following command</p>
  
  <pre><code>MyTextBox.Text = "Hello!";
  </code></pre>
  
  <p>However, there is another way to have the same behavior by use of binding when in XAML we have</p>
  
  <pre><code>&lt;TextBox x:Name="MyTextBox" Text="{Binding Content}" /&gt;
  </code></pre>
  
  <p>and in C# we have</p>
  
  <pre><code>public class MyText : INotifyPropertyChanged
  {
      public event PropertyChangedEventHandler PropertyChanged;
      private string _content;
      public string Content
      {
          get { return _content; }
          set
          {
              _content = value;
              PropertyChanged(this, new PropertyChangedEventArgs("Content"));
          }
      }
  }
  
  MyText txt = new MyText();
  MyTextBox.DataContext = txt;
  txt.Content = "Hello!";
  </code></pre>
  
  <p>Obviously the second option needs more coding, but the result of both of them are the same. However, in second case I do not have to care about executing the code on UI thread. So everywhere in my code when I change <code>txt.Content</code> the string in the textbox will change without any exception.</p>
  
  <p><strong>My question is:</strong> Is there any design issue preferences over any of these two options for changing a property?</p>