有两种办法:

1. 直接在后台处理
在数据绑定后 ,注册LoadingRow 事件
this.DataGrid.LoadingRow += new EventHandler<DataGridRowEventArgs>(DataGrid_LoadingRow);

void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
      Task ts = e.Row.DataContext as Task;
      ToolTipService.SetToolTip(e.Row, ts.Name);
      //throw new NotImplementedException();
}

2. 稍微麻烦点, 重写datagrid row 模板, 
在微软msdn 上能找到 行模板,找到

<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="0"/>
 </Storyboard>
在后面加上
<Storyboard> 
<DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="0" ToolTipService.ToolTip="{Binding Name}"/> 
 </Storyboard>

相关文章:

  • 2022-01-17
  • 2022-01-22
  • 2021-09-06
  • 2022-03-02
  • 2022-12-23
  • 2022-03-08
  • 2021-11-21
  • 2022-12-23
猜你喜欢
  • 2022-03-07
  • 2022-12-23
  • 2021-08-26
  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
相关资源
相似解决方案