'宣言 Public Class BeforeDisplayDataErrorTooltipEventArgs Inherits System.ComponentModel.CancelEventArgs
public class BeforeDisplayDataErrorTooltipEventArgs : System.ComponentModel.CancelEventArgs
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub UltraGrid1_BeforeDisplayDataErrorTooltip(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeDisplayDataErrorTooltipEventArgs) Handles UltraGrid1.BeforeDisplayDataErrorTooltip ' You can get the instance of the IDataErrorInfo that provided the UltraGrid ' with the error using the DataErrorInfo property. Dim dataErrorInfo As System.ComponentModel.IDataErrorInfo = e.DataErrorInfo ' You can get the underlying list object using the row's ListObject property. Dim listObject As Object = e.Row.ListObject ' If the UltraGrid is bound to a DataSet or DataTable then the listObjects ' are instances of DataRowView. You can get the underlying DataRow from it. Dim drv As DataRowView = Nothing Dim dataRow As DataRow = Nothing If TypeOf listObject Is DataRowView Then drv = DirectCast(listObject, DataRowView) dataRow = drv.Row End If ' You can modify the tooltip text by setting the TooltipText property. If Not Nothing Is e.Column Then ' If Column is non-null then the tooltip is being displayed for the ' error icon of a cell. e.TooltipText = "Cell Data Error Tooltip for " & e.Column.Key & ": " & e.TooltipText Else ' If the Column is null then the tooltip is being displayed for the ' error icon of a row selector. e.TooltipText = "Row Data Error Tooltip: " & e.TooltipText End If ' You can conditionally prevent the displaying of the tooltip by setting ' the Cancel to true. If e.TooltipText.Length > 10000 Then e.Cancel = True End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void UltraGrid1_BeforeDisplayDataErrorTooltip(object sender, Infragistics.Win.UltraWinGrid.BeforeDisplayDataErrorTooltipEventArgs e) { // You can get the instance of the IDataErrorInfo that provided the UltraGrid // with the error using the DataErrorInfo property. System.ComponentModel.IDataErrorInfo dataErrorInfo = e.DataErrorInfo; // You can get the underlying list object using the row's ListObject property. object listObject = e.Row.ListObject; // If the UltraGrid is bound to a DataSet or DataTable then the listObjects // are instances of DataRowView. You can get the underlying DataRow from it. DataRowView drv = null; DataRow dataRow = null; if ( listObject is DataRowView ) { drv = (DataRowView)listObject; dataRow = drv.Row; } // You can modify the tooltip text by setting the TooltipText property. if ( null != e.Column ) { // If Column is non-null then the tooltip is being displayed for the // error icon of a cell. e.TooltipText = "Cell Data Error Tooltip for " + e.Column.Key + ": " + e.TooltipText; } else { // If the Column is null then the tooltip is being displayed for the // error icon of a row selector. e.TooltipText = "Row Data Error Tooltip: " + e.TooltipText; } // You can conditionally prevent the displaying of the tooltip by setting // the Cancel to true. if ( e.TooltipText.Length > 10000 ) { e.Cancel = true; } }