你的位置:首页 > 软件开发 > ASP.net > 【转】WPF 给DataGridTextColumn统一加上ToolTip

【转】WPF 给DataGridTextColumn统一加上ToolTip

发布时间:2015-06-25 12:00:03
源地址:http://dongguojun.iteye.com/blog/1671963我发现WPF中DataGridTextColumn直接设置它的ToolTipService.Tooltip并不好使,当然可以在这个列的CellStyle中再设置ToolTipService.T ...

源地址:http://dongguojun.iteye.com/blog/1671963

我发现WPF中DataGridTextColumn直接设置它的ToolTipService.Tooltip并不好使,当然可以在这个列的CellStyle中再设置ToolTipService.Tooltip的值,这是管用的。但是当列比较多的时候,这样一一设置比较麻烦。下面介绍一个统一的设置方法,在DataGrid中统一设置CellStyle

<DataGrid.CellStyle>   <Style TargetType="DataGridCell">       <Setter Property="ToolTipService.ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content.Text}"/>   </Style></DataGrid.CellStyle>

原标题:【转】WPF 给DataGridTextColumn统一加上ToolTip

关键词:wpf

wpf
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。