我在WPF的数据网格中有一个列,其中的文本将溢出 . 我试图找到一种方法来显示用户将鼠标悬停在单元格/列上时的文本 . 我认为使用工具提示将是最简单/最好的方式,但我无法弄清楚如何 .

EDIT:

我目前正在尝试通过在XAML WPF代码中创建样式来实现此目的:

<Window.Resources>
    <Style TargetType="DataGridCell" x:Key="toolTipCell">
        <Setter Property="ToolTip" Value="Cell content here"/>
    </Style>
</Window.Resources>

然后在AutoGeneratingColumn事件的代码中执行此代码:

If e.PropertyName = "MasterName" Then
        'e.Cancel = True
        e.Column.Width = New DataGridLength(1, DataGridLengthUnitType.Star)
        e.Column.CellStyle = TryCast(FindResource("toolTipCell"), Style)
    End If

但我不知道如何使单元格的值成为工具提示的 Value