Data Binding with Silverlight accordion Control -


i have silverlight accordion control in childwindow , customized following way

<style x:key=itemstyle targettype=accordionitem>   <setter porperty=headertemplate>     <datatemplate>       <textblock x:name=_headertext/>     </datatemplate>   </setter> </style>  <accordion style"{staticresource itemstyle}">   <accordion.contenttemplate>     <datatemplate>       <stackpanel>         <checkbox/>         <textblock x:name=_contenttext/>     </datatemplate>   <accordion.contenttemplate> </accordion> 

now have method in chilwindow.xaml

public void  loaditems(observablecolection<groups> gp) {} 

this method called mainpage , passes gp value

groups class public properties , observable collections.for example

public class groups {   public string firstname{get, set;}    public observablecollection<details> details {get, set;}    public groups()   {     this.details=new observablecollection<details>();   }  }  details class follows  public class details {    public int id {get; set;}    public string lastname{get; set;}     --------    ------- } 

now have bind _headertext(textblock in header template) firstname , _contenttext(textblock in content template) lastname.

please me in doing this.i need help.

thanks rani

why not use databinding in xaml directly? should not need in code.

<style x:key=itemstyle targettype=accordionitem>    <setter porperty=headertemplate>      <datatemplate>        <textblock text="{binding firstname}"/>      </datatemplate>    </setter>  </style>   <accordion style"{staticresource itemstyle}">    <accordion.contenttemplate>      <datatemplate>        <stackpanel>          <checkbox/>          <textblock text="{binding lastname}"/>      </datatemplate>    <accordion.contenttemplate>  </accordion>  

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -