首页 新闻 赞助 找找看

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

0
悬赏园豆:10 [待解决问题]
在一个ChildWindow里使用TabControl分两个TabItem,
每个TabItem都有一个DataGrid。
给两个DataGrid里的行设置了ToolTipService

代码如下
 1 ToolTipStrings tipStrings = new ToolTipStrings();
 2 
 3 private void dgMaintain_LoadingRow(object sender, DataGridRowEventArgs e)       
 4 {            
 5   int index = e.Row.GetIndex();                
 6   var maintain = e.Row.DataContext as Maintain;                
 7   if (maintain != null)                
 8   {                    
 9     ToolTipService.SetToolTip(e.Row, tipStrings.GetMaintainListTips(maintain));
10   }                   
11 }
12 
13 private void dgLedger_LoadingRow(object sender, DataGridRowEventArgs e)        
14 {           
15    int index = e.Row.GetIndex();                
16   var ledger = e.Row.DataContext as Ledger;                
17   if (ledger != null)                
18   {                    
19     ToolTipService.SetToolTip(e.Row, tipStrings.GetLedgerListTips(ledger));  
20   }           
21 }

 



运行后,鼠标滚动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:51
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册