views:

7

answers:

1

i am working with a silverlightdatgrid and i have a style for each column header as below

<Style x:Name="mytemplate" x:Key="mytemplate"  xmlns:dataprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
                            TargetType="dataprimitives:DataGridColumnHeader">
            <Setter Property="ContentTemplate" >
                <Setter.Value>
                    <DataTemplate x:Name="ColHeaderTemplategrid">
                         <StackPanel>
                             <TextBlock Text="{Binding  this.Content}" ></TextBlock>
                             <TextBox x:Name="txtfilterBox"  KeyDown="txtfilterBox_KeyDown" Width="40"/>
                        </StackPanel>

                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>

now the problem is how can i bind the each column header value as the text for the text block inside the stackpanel.i was just trying with Text="{Binding this.Content}" ,but it doesn't works. how can i bind columns header value as the text block's text

A: 

hi the below code sorted out my issue would bind the current columns header as the text foe the text block

<DataTemplate x:Name="ColHeaderTemplategrid">
                         <StackPanel>
                             <TextBlock Text="{Binding}" ></TextBlock>
                             <TextBox x:Name="txtfilterBox"  KeyDown="txtfilterBox_KeyDown" Width="40"/>
                        </StackPanel>

                    </DataTemplate>
subash