1

So I have a DataGrid and I would like to be able to display data from what ever cell the mouse is over using the ToolTip service. Can someone tell me what I am doing wrong. Thanks a lot.

Here is my DataGrid:

<DataGrid Name="dgData" CanUserAddRows="False" 
                        Style="{DynamicResource DataGridRow}" 
                        AutoGenerateColumns="False"
                        CanUserReorderColumns="False"
                        EnableColumnVirtualization="True" />

And here is what I have tried, but my app wont load the DataGrid when I add this.

<Style TargetType="{x:Type DataGrid}">
    <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value}" />
</Style>
4

1 回答 1

2

请将此添加到您的资源中

<Style TargetType="{x:Type DataGridCell}">
    <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Content.Text}" />
</Style>
于 2013-07-19T04:27:32.760 回答