title: Use a binding to set the text property of a textbox in a usercontrol - WPF
body: <p>I have a user control which contains a textbox and have created a get/set in the usercontrol to get/set the text property of the textbox. </p>
  
  <pre><code>public class OpenFileControl : UserControl
  {
      StackPanel sp;
      public TextBox tb;
  
      public string Text { get { return tb.Text; } set { tb.Text = value; } }
  </code></pre>
  
  <p>I then want to set this value based on a binding later on -</p>
  
  <pre><code>&lt;gX3UserControls:OpenFileControl Text="{Binding Value}"  /&gt;
  </code></pre>
  
  <p>But I get the following exception
  A 'Binding' cannot be set on the 'Text' property of type 'OpenFileControl'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.</p>
  
  <p>After some investigation It seems Text needs to be a dependency property, but If I do that I cant work out how to pass the value on to the textbox. </p>
  
  <p>How can I fix this. </p>