title: Very basic DependencyProperty problem in WPF - tyring to bind to a complex object
body: <p>I'm just getting started with WPF.
  I have TextBox declared in xmal like so:</p>
  
  <pre><code>&lt;TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=TestComplex.Something, Mode=TwoWay}"/&gt;
  </code></pre>
  
  <p>In my code behind I have registered the property that I am trying to bind to like so:</p>
  
  <pre><code>public TestComplexObject TestComplex
      {
          get { return (TestComplexObject)GetValue(TestComplexProperty); }
          set { SetValue(TestComplexProperty, value); }
      }
  
      public static readonly DependencyProperty TestComplexProperty=
          DependencyProperty.Register("TestComplex", typeof(TestComplexObject ), typeof(MainWindow), new UIPropertyMetadata(new TestComplexObject ()));
  </code></pre>
  
  <p>The TestComplexObject class:</p>
  
  <pre><code>public class TestComplexObject : DependencyObject 
  {
      public string Something
      {
          get { return (string)GetValue(SomethingProperty ); }
          set { SetValue(ExeLocationProperty, value); }
      }
  
      public static readonly DependencyProperty SomethingProperty =
          DependencyProperty.Register("Something", typeof(string), typeof(TestComplexObject), new UIPropertyMetadata("Test Text"));
  
  }
  </code></pre>
  
  <p>As you can see I'm trying to bind the TextBox to TestComplex.Something, however when I run this all I get is a xmal parse exception, </p>
  
  <blockquote>
    <p>"'The invocation of the constructor on
    type 'EmuRunner.MainWindow' that
    matches the specified binding
    constraints threw an exception.' Line
    number '6' and line position '9"</p>
  </blockquote>
  
  <p>I really have no idea what I'm doing wrong here, can anyone help?</p>
  
  <p>Thanks in advance.</p>