title: Data Binding with Silverlight accordion Control
body: <p>I have Silverlight Accordion control in the ChildWindow and I customized it the following way</p>
  
  <pre><code>&lt;Style x:Key=itemStyle TargetType=AccordionItem&gt;
    &lt;Setter Porperty=HeaderTemplate&gt;
      &lt;DataTemplate&gt;
        &lt;TextBlock x:Name=_headertext/&gt;
      &lt;/DataTemplate&gt;
    &lt;/Setter&gt;
  &lt;/Style&gt;
  
  &lt;Accordion Style"{StaticResource itemStyle}"&gt;
    &lt;Accordion.ContentTemplate&gt;
      &lt;DataTemplate&gt;
        &lt;StackPanel&gt;
          &lt;CheckBox/&gt;
          &lt;TextBlock x:name=_contenttext/&gt;
      &lt;/DataTemplate&gt;
    &lt;Accordion.ContentTemplate&gt;
  &lt;/Accordion&gt;
  </code></pre>
  
  <p>Now I have a method in my Chilwindow.Xaml</p>
  
  <pre><code>public void  LoadItems(ObservableColection&lt;Groups&gt; gp)
  {}
  </code></pre>
  
  <p>This method is called from the mainpage and it passes the gp value</p>
  
  <p>Groups is a class with public properties and Observable collections.For example</p>
  
  <pre><code>public class Groups
  {
    public string FirstName{get, set;}
  
    public ObservableCollection&lt;Details&gt; details {get, set;}
  
    public Groups()
    {
      this.details=new ObservableCollection&lt;Details&gt;();
    }
  
  }
  
  My Details Class is as follows
  
  public class Details
  {
     public int id {get; set;}
     public string LastName{get; set;} 
     --------
     -------
  }
  </code></pre>
  
  <p>Now I have to bind the _headertext(TextBlock in header Template) with the FirstName and _contenttext(TextBlock in Content Template) with LastName.</p>
  
  <p>Please help me in doing this.I need your help.</p>
  
  <p>Thanks
  Rani</p>