Binding element inside datatemplate

1 posts, 0 answers
  1. Ishita
    Ishita avatar
    30 posts
    Member since:
    Nov 2013

    Posted 22 Sep 2014 Link to this post

          As per the requirement , i have a Gridviewcolumn in TreeListView for Icon + Text in a single cell. 
    I am using data template. 
    <DataTemplate x:Key="datatemplate">
                     <ColumnDefinition Width="Auto"/>
                     <ColumnDefinition Width="*"/>
                 <Image Grid.Column="0" Source="{Binding TreeList_IconImage, Converter={StaticResource ConvertStringToImge}}"/>
                 <TextBlock Grid.Column="1" Name="txtText"  />
     in Xaml.cs , C#
    GridViewColumn templateColumn = new GridViewColumn();
                               templateColumn.CellTemplate = (DataTemplate)Resources["datatemplate"];
                               templateColumn.Header = SLColumnName[ColumnName.Key.ToString()].ToString();
                               // I want to set bindning to TextBlock inside Datatemplate.
     I want to set bindning to TextBlock which is inside Datatemplate. 
     I dont want to set binding in xaml page as the name of column will come from database. 

Back to Top