title: Binding complex properties in Silverlight/WPF
body: <p>Lets say I have a custom data type that looks something like this:</p>
  
  <pre><code>public class MyDataType
  {
    public string SimpleProp1;
    public string SimpleProp2;
    public List&lt;SomeType&gt; ComplexProp;
  }
  </code></pre>
  
  <p>now I hava a data bound control (i.e. ItemsControl or DataGrid), that is created dynamically.
  How would the binding defined in xaml code look like to acces a subproperty of the complex property? I thought it should look something like this:</p>
  
  <pre><code>&lt;TextBox Text="{Binding simpleSubProp, path=ComplexProp[0]}" /&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;TextBox Text="{Binding path=ComplexProp[0].simpleSubProp}" /&gt;
  </code></pre>
  
  <p>but both of those give me xml parse errors. How should it look correctly? Is it even possible to refer to a specific item of a collection property in souch a way? If it is not, what other options do I have?</p>
  
  <p>EDIT, The scenario doesn't seem to be clear enough:</p>
  
  <p>I have an</p>
  
  <pre><code>IEnumberable&lt;MyDataType&gt;
  </code></pre>
  
  <p>that is bound to an ItemsControl, inside the DataTemplate I have multiple TextBoxes that need to refer to subproperties of an object in the List of the complex property.</p>