views:

251

answers:

1

As in Silverlight I can't bind directly to a DataGridColumn's property, in order to dynamically change the text of the column header, I have to write the following code using HeaderStyle.

                            <data:DataGridTextColumn.HeaderStyle>
                                <Style TargetType="dataprimitives:DataGridColumnHeader">
                                    <Setter Property="ContentTemplate">
                                        <Setter.Value>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Resource.ClientName, Mode=OneWay}"/>
                                            </DataTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </data:DataGridTextColumn.HeaderStyle>
                        </data:DataGridTextColumn>

My problem is that now I need to get the Name of the TextBlock from grid.Columns[index]. Is there any way I can do this? I tired to use VisualTreeHelper but since DataGridColumn is not a FrameworkElement it will throw me an error...

Any help would be greatly appreciated!

Xin

A: 

Did you get any Answer for this one>?

HMY

related questions