In the last two days, since it’s the end of our block I have decided to do some minor work (that way a check in won’t really effect the block). One of the changes I thought of was replacing all the free text in our Silverlight application with text from a resource file.
Everything worked like a charm except for the Header of DataGridTextColumn. My original Data Binding looked like this:
- <slData:DataGridTextColumn Header="{Binding Path=Type, Source={StaticResource StringsRes}}" Binding="{Binding Title}"/>
But the DataGrid columns in the application looked like this:
In the end I found the solution here:
- <slData:DataGridTextColumn Binding="{Binding TypeString}" >
- <sdk:DataGridTextColumn.HeaderStyle>
- <Style TargetType="primitives:DataGridColumnHeader" >
- <Setter Property="ContentTemplate">
- <Setter.Value>
- <DataTemplate>
- <TextBlock Text="{Binding Path=Type, Source={StaticResource StringsRes}}"/>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </sdk:DataGridTextColumn.HeaderStyle>
- </slData:DataGridTextColumn>
Though I am still searching for a generic solution and not something I have to copy paste for each DataGrid Column…
//TODO: Check if this was fixed in SL5. If so post the elegant solution