Using the code in the sample "WinToolTipManager - Tool Tips with Context" I am able to create a balloon ToolTip for a UltraGridCell by using the SetColumnError method:
row.SetColumnError("ColumnKey","Tool tip message."
This works quite well (though somewhat cumbersome using the helpers classes) provided the underlying data source is a datatable.
How can I achieve this same functionality when the data source is an IbindingList? Since the list doesn't have rows (only a collection of entities), there is no SetColumnError method.
Hi,
Jake K said:How do I set a cell's SetColumnError in UltraGrid2 when there is no underlying DataRow?
If you are using a generic List<T> and not a DataTable, then the only way to set the data error would be if your custom type (T) supported IDataErrorInfo.
I think there is some confusion here because you are mixing two totally different sets of functionality. The IDataErrorInfo in the grid has no connection to UltraToolTipManager. The Tooltips from data errors are shown by the grid - they are built-in.
So it seems to me that if you have two choices.
1) Implement IDataErrorInfo on your list object. This may not be possible, of course, if you are using some other third-party data source and cannot inherit from the objects.
2) Simply add an Image to the cell via the appearance and show a tooltip when the user hovers over that cell using the UltraToolTipManager with Context sample code. If you take this second approach, then it might be a good idea to create a hidden, unbound column in the grid and store the error text in that hidden column. That way, you can apply the image to the cell in the InitializeRow event based on the contents of the hidden column and also get the text for the tooltip from the hidden column.
Okay, let's try it this way....
I have two UltraGrids: UltraGrid1 and UltraGrid2UltraGrid1 has for its DataSource a System.Data.DataTableUltraGrid2 has for its DataSource a System.Collections.Generics.List
If I handle each grid's DoubleClickCell event, in UltraGrid1 I can obtain the underling cell's DataRow and set the error handler for the cell using the SetColumnError method.
How do I set a cell's SetColumnError in UltraGrid2 when there is no underlying DataRow?
Your example, works, but my UltraGrid has 7 bands and over 300 columns.I could convert the nested list to a DataSet, but the collection is a CodeFLuent entities collection and I would loose all of the entities' functionality.
This is a simple sample demonstrating using the two types of datasources I describe above.
public void SetUpUltraGrid1() { myTable = new DataTable(); myTable.Columns.Add("Col01", typeof(int)); for (int i = 1; i <= 4; i++) { DataRow myRow = default(DataRow); myRow = myTable.NewRow(); myRow[0] = i; myTable.Rows.Add(myRow); } ultraGrid1.DataSource = myTable; ultraGrid1.DisplayLayout.Bands[0].Columns[0].SupportDataErrorInfo = Infragistics.Win.DefaultableBoolean.True; } public void SetUpUltraGrid2() { Int32[] myInt={1,2,3,4}; myList = new List<int>(myInt); ultraGrid2.DataSource = myList; } private void UltraGrid1_DoubleClickCell(object sender, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs e) { DataRow row = null; DataRowView view = null; view = (DataRowView)e.Cell.Row.ListObject; row = (DataRow)view.Row; row.SetColumnError(e.Cell.Column.Key, "Set an error"); } private void UltraGrid1_DoubleClickCell(object sender, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs e) { // How can I set the cell's error object here? }
public void SetUpUltraGrid1() { myTable = new DataTable(); myTable.Columns.Add("Col01", typeof(int)); for (int i = 1; i <= 4; i++) { DataRow myRow = default(DataRow); myRow = myTable.NewRow(); myRow[0] = i; myTable.Rows.Add(myRow); } ultraGrid1.DataSource = myTable; ultraGrid1.DisplayLayout.Bands[0].Columns[0].SupportDataErrorInfo = Infragistics.Win.DefaultableBoolean.True; }
public void SetUpUltraGrid2() { Int32[] myInt={1,2,3,4}; myList = new List<int>(myInt); ultraGrid2.DataSource = myList; }
private void UltraGrid1_DoubleClickCell(object sender, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs e) { DataRow row = null; DataRowView view = null; view = (DataRowView)e.Cell.Row.ListObject; row = (DataRow)view.Row; row.SetColumnError(e.Cell.Column.Key, "Set an error"); }
private void UltraGrid1_DoubleClickCell(object sender, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs e) { // How can I set the cell's error object here? }
this is the sample
Here is the video file
Hello Jake,
Could you please take a look at the attached sample and video file and let me know if you have any questions.
Regards