将当前列标题绑定为数据模板内文本块的文本
我正在使用 silverlightdatgrid,每个列标题都有一个样式,如下所示
<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>
,现在的问题是如何将每个列标题值绑定为 stackpanel 内文本块的文本。我只是尝试使用 Text="{绑定 this.Content}" ,但它不起作用。如何将列标题值绑定为文本块的文本
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您好,下面的代码解决了我的问题,将当前列标题绑定为文本块的文本
hi the below code sorted out my issue would bind the current columns header as the text foe the text block