WPF DATAGRID TOOL TIP SERVICE

marcel ethan

Total Post:105

Points:735
Posted by  marcel ethan
WPF 
WPF
 3084  View(s)
Ratings:
Rate this:

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>

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: WPF dataGrid tool tip service

    Hi Marcel,


    Please add this in your resources

    <Style TargetType="{x:Type DataGridCell}">

        <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Content.Text}" />

    </Style>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!