2
Answers

Binding DataGrid Column Header at Runtime

Adeel Ansari

Adeel Ansari

15y
13k
1

i have Silverlight Datagrid,i have to make my column header name at runtime ,i successfully bind the column with my class object means binding at runtime , but the problem is that column header name is not showing dynamic text according to my resource file infect the text is not showing at all,anyone help me out to solve this issue in showing the text of column header dynamically,its really urgent, thankz in advance,my code for 1 column is
 
<
data:DataGridTextColumn Header="TuesdayHeader" Binding="{Binding Tuesday, Converter={StaticResource VisibilityConverter}}">
   <data:DataGridTextColumn.HeaderStyle>
      <Style TargetType="primitives:DataGridColumnHeader">
         <Setter Property="ContentTemplate">
            <Setter.Value>
               <DataTemplate>
                  <TextBlock Text="{Binding TuesdayHeader, Source={StaticResource VisibilityConverter}}"/>
               </DataTemplate>
         </Setter.Value>
      </Setter>
      </Style>
</data:DataGridTextColumn.HeaderStyle>
</data:DataGridTextColumn>
Answers (2)