How to set Tooltip in Datagrid for a Row?

Jun 21, 2010 at 8:22 AM

Hi,

 

I want to set Tooltip for a whole row. Tooltip data is one of the class property which i want to bind. For one column I did it & working fine. it is like below.

 

 <Grid>
        <dg:DataGrid AutoGenerateColumns="False" x:Name="dgPerson">
           
            <dg:DataGrid.Columns>
               
                <dg:DataGridTextColumn Width="150" Header="First Name" Binding="{Binding FirstName}"  >
                    <dg:DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="ToolTip" Value="{Binding ToolTips}" />
                        </Style>
                    </dg:DataGridTextColumn.ElementStyle>
                </dg:DataGridTextColumn>
                <dg:DataGridTextColumn Width="150" Binding="{Binding LastName}" Header="Last Name"/>
            </dg:DataGrid.Columns>
        </dg:DataGrid>

 

    </Grid>

 

For above code if am trying to do with windows resources then again ToolTip not coming. What am doing is below:

 

 <Window.Resources>

 

  <Style x:Name="ToolTipBinding" TargetType="{x:Type TextBlock}">

 

    <Setter Property="ToolTip" Value="{Binding ToolTips}" />

 

  </Style>

 

</Window.Resources>

 

<dg:DataGridTextColumn Width="150" Header="First Name" Binding="{Binding FirstName}"

      ElementStyle="{DynamicResource ToolTipBinding }" />

 

I Found some help from net like below:

<Style TargetType="{x:Type Custom:DataGridColumnHeader}">
   <Style.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
          <Setter Property="ToolTip" Value="{Binding Column.(ToolTipService.ToolTip), RelativeSource={RelativeSource Self}}"/>
      </Trigger>
   </Style.Triggers>
</Style>

I applied but Tooltip not displaying for me.

can anyone help me for this? If it is columnwise also then also not problem but should come from Resource. If it is rowwise then its very good for me.

Thanks is Advance.