title: Binding Simple WPF TextBox Text TwoWay
body: <p>I am very sorry that this question is very basic. I just learned WPF and I failed to make simple two way binding to textbox.text to string property.</p>
  
  <p>XAML Code:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:WpfApplication1"
      mc:Ignorable="d"
      Title="MainWindow" Height="350" Width="525"&gt;
  &lt;Grid x:Name="StuInfo"&gt;
      &lt;TextBox x:Name="textBox" HorizontalAlignment="Left" Height="23" Margin="10,26,0,0" TextWrapping="Wrap" Text="{Binding Path=str,Mode=TwoWay}" VerticalAlignment="Top" Width="120"/&gt;
      &lt;Button x:Name="button" Content="Check" HorizontalAlignment="Left" Margin="10,67,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>C# Code</p>
  
  <pre><code>public partial class MainWindow : Window
  {
      public MainWindow()
      {
          InitializeComponent();
          str = "OK";
      }
  
      public string str { get; set; }
  
      private void button_Click(object sender, RoutedEventArgs e)
      {
          Console.WriteLine(str);
      }
  }
  </code></pre>
  
  <p>First, the textbox does not show "OK", but it is blank. Then, I typed a different text into the textbox, for ex:"blablabla" without the quotes. Then I click the button to check if my str property has been updated. Apparently, str still contains "OK".</p>
  
  <p>What did I do wrong here? What did I miss to make the binding work?</p>