【转】WPF 给DataGridTextColumn统一加上ToolTip

源地址:https://www.cnblogs.com/ZXdeveloper/p/4599500.html

在开发的过程中发现,如果给datagrid的每一列都单独添加提示太麻烦,于是在网上找了下统一设置Tooltip的方法,下面就是一种统一的设置方法。

亲测可用,代码如下:

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

 

posted @ 2019-10-09 11:38  MaxFish  阅读(701)  评论(0编辑  收藏  举报