title: Binding between Resources.DataTemplate and ListBox.DataTemplate - Windows Phone
body: <p>I'm having problems to do a binding in Windows Phone. Hope you can help me.</p>
  
  <p>I have the following Data Template in App.xaml:</p>
  
  <blockquote>
    <p><code>&lt;Application.Resources&gt;</code><br>
    <code>&lt;DataTemplate&gt;</code><br>
    <code>&lt;TextBox Name="txt1"/&gt;</code><br>
    <code>&lt;TextBox Name="txt2"/&gt;</code><br>
    <code>&lt;/DataTemplate&gt;</code><br>
    <code>&lt;/Application.Resources&gt;</code></p>
  </blockquote>
  
  <p>I have a ListBox with the following Data Template:</p>
  
  <blockquote>
    <p><code>&lt;ListBox&gt;</code><br>
    <code>&lt;ListBox.ItemTemplate&gt;</code><br>
    <code>&lt;DataTemplate&gt;</code><br>
    <code>&lt;TextBox Name="txt1"/&gt;</code><br>
    <code>&lt;TextBox Name="txt2"/&gt;</code><br>
    <code>&lt;/DataTemplate&gt;</code><br>
    <code>&lt;ListBox.ItemTemplate&gt;</code><br>
    <code>&lt;ListBox&gt;</code></p>
  </blockquote>
  
  <p>The ListBox receives the following Class in the ItemsSource Property:</p>
  
  <pre><code>public class Product
  {
  
     private int _id;
     public int Id
     {
         get { return _id; }
         set { _id = value; }
     }
  
     private string _name;
  
     public string Name
     {
         get { return _name; }
         set { _name = value; }
     }
  
  }
  </code></pre>
  
  <p>Is there anyway to bind the Resources.TextBox.Text property with the Object of the ListBoxItem like...</p>
  
  <blockquote>
    <p><code>&lt;Application.Resources&gt;</code><br>
    <code>&lt;TextBox Name="txt1" Text={Binding ElementName=ListBox, Path=SelectedItem.Product.Name}/&gt;</code><br>
    <code>&lt;/Application.Resources&gt;</code></p>
  </blockquote>