Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add custom tooltip to row in DataGrid

I would like to customize my DataGrid to show a tooltip within the selected row, please see the mockup images below for a better idea of what I want to achieve.

As it is at the moment - Shows a single selected row: enter image description here

How I would like - Shows the same row selected, now with tooltip:

enter image description here

  • My DataGrid uses Binding to the ViewModel.
  • Working with WPF & C# for Windows desktop.

I don't really have any idea how to achieve this, so I'm open to any suggestions at all.

like image 242
Drahcir Avatar asked Nov 21 '12 15:11

Drahcir


1 Answers

I use the DataGrid.RowStyle to set the tooltip.

My bound objects have a ToolTipText property which contains the content of the ToolTip.

<DataGrid.RowStyle>
    <Style TargetType="DataGridRow">
        <Setter Property="ToolTip">
            <Setter.Value>
                <TextBlock Text="{Binding ToolTipText}" />
            </Setter.Value>
        </Setter>
    </Style>
</DataGrid.RowStyle>
like image 170
Martin Avatar answered Oct 26 '22 21:10

Martin