title: Binding a Textbox to a property in WPF
body: <p>I have a Textbox in a User Control i'm trying to update from my main application but when I set the textbox.Text property it doesnt display the new value (even though textbos.Text contains the correct data). I am trying to bind my text box to a property to get around this but I dont know how, here is my code -</p>
  
  <p><strong>MainWindow.xaml.cs</strong> </p>
  
  <pre><code>outputPanel.Text = outputText;
  </code></pre>
  
  <p><strong>OutputPanel.xaml</strong></p>
  
  <pre><code>&lt;TextBox x:Name="textbox" 
               AcceptsReturn="True" 
               ScrollViewer.VerticalScrollBarVisibility="Visible"
               Text="{Binding &lt;!--?????--&gt; }"/&gt;  &lt;!-- I want to bind this to the Text Propert in OutputPanel.xmal.cs --&gt;                               
  </code></pre>
  
  <p><strong>OutputPanel.xaml.cs</strong></p>
  
  <pre><code> namespace Controls
  {
  public partial class OutputPanel : UserControl
  {
      private string text;
  
      public TextBox Textbox
      {
          get {return textbox;}
      }
  
      public string Text
      {
          get { return text; }
          set { text = value; }
      }
  
      public OutputPanel()
      {
          InitializeComponent();
          Text = "test";
          textbox.Text = Text;
      }
  
  }
  </code></pre>
  
  <p>}</p>