首页 新闻 赞助 找找看

Silverlight,DataGrid滚动行ToolTipService.SetToolTip()>对 COM 组件的调用返回了错误 HRESULT E_FAIL。

0
悬赏园豆:10 [已关闭问题] 关闭于 2012-05-05 10:56
在一个ChildWindow里使用TabControl分两个TabItem,
每个TabItem都有一个DataGrid。
给两个DataGrid里的行设置了ToolTipService

代码如下
private void dgMaintain_LoadingRow(object sender, DataGridRowEventArgs e)
{
  int index = e.Row.GetIndex();
  var maintain = e.Row.DataContext as Maintain;
  if (maintain != null)
  {
    ToolTipService.SetToolTip(e.Row, tipStrings.GetMaintainListTips(maintain));
  }
}

private void dgLedger_LoadingRow(object sender, DataGridRowEventArgs e)
{
   int index = e.Row.GetIndex();
  var ledger = e.Row.DataContext as Ledger;
  if (ledger != null)
  {
    ToolTipService.SetToolTip(e.Row, tipStrings.GetLedgerListTips(ledger));
  }
}

运行后,鼠标滚动DataGrid的行,
ToolTipService.SetToolTip(); 会报错

用户代码未处理 System.Exception
Message=对 COM 组件的调用返回了错误 HRESULT E_FAIL。
StackTrace:
位于 子窗体.dgLedger_LoadingRow(Object sender, DataGridRowEventArgs e)
位于 System.Windows.Controls.DataGrid.OnLoadingRow(DataGridRowEventArgs e)
位于 System.Windows.Controls.DataGrid.GenerateRow(Int32 rowIndex, Int32 slot, Object dataContext)
位于 System.Windows.Controls.DataGrid.GenerateRow(Int32 rowIndex, Int32 slot)
位于 System.Windows.Controls.DataGrid.InsertDisplayedElement(Int32 slot, Boolean updateSlotInformation)
位于 System.Windows.Controls.DataGrid.GetExactSlotElementHeight(Int32 slot)
位于 System.Windows.Controls.DataGrid.UpdateDisplayedRows(Int32 newFirstDisplayedSlot, Double displayHeight)
位于 System.Windows.Controls.DataGrid.ScrollSlotsByHeight(Double height)
位于 System.Windows.Controls.DataGrid.OnRowsMeasure()
位于 System.Windows.Controls.Primitives.DataGridRowsPresenter.MeasureOverride(Size availableSize)
位于 System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight) InnerException:
LosDuns的主页 LosDuns | 初学一级 | 园豆:194
提问于:2012-05-05 10:40
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册