Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

wpf - Unable to set DataGridColumn's ToolTip

I tried the following:

<tk:DataGridTextColumn 
    Header="Item" 
    Binding="{Binding Item.Title}" 
    ToolTipService.ToolTip="{Binding Item.Description}" />

And I don't see any tool tip.

Any ideas? Is it even implemented?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This works for me:

<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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...