Say I have the following
Dim objList as List(Of MyObject) = GetMyObjects()myGrid.DataSource = objList
How can I recuperate the myActiveObj from the myDataGrid. ActiveRow?
The object should be in myDataGrid.ActiveRow.ListObject
Public ReadOnly Property ListObject As Object Member of Infragistics.Win.UltraWinGrid.UltraGridRow
Summary: Returns the object corresponding to this row from the IList that the control is bound to. Returns Null if this is an UltraGridGroupByRow.
Michael
I agree, it should be, but is not . Instead of myObject, is a UltraDataRow, data does not contain any reference to the MyObject instance from the boud list:
If you are binding the grid to a List of custom objects (myObject), then there is no way the grid row's ListObject could possibly be returning an UltraDataRow. UltraDataRow is only used by the UltraDataSource.
So if you are getting an UltraDataRow from the ListObject property of a row, then your grid must be bound to an UltraDataSource.
So you are either not binding the grid what you think you are, or else you are looking at the rows of the wrong grid.
I should recognize, that if I cast the grid's dataSource to a UltraDataSource, I obtain something, that is not Nothing (not null).
But, anyway, I set that grid's DataSource to a List(Of MyObject)... And after setting the DataSource in this way, the ObjectList is always a UltraDataRow....
Actually, because I have no idea how to obtain the instance of my dataSource object, I dropped the idea of using this kind of dataSource, and I set it in the Tag property, like this:
Normal 0 21 false false false MicrosoftInternetExplorer4
Dim source As Infragistics.Win.UltraWinDataSource.UltraDataSource = DirectCast(grdListe.DataSource, Infragistics.Win.UltraWinDataSource.UltraDataSource)
If source Is Nothing OrElse source.Rows Is Nothing Then Throw New NullReferenceException("DataSource")
source.Rows.Clear()
Dim row(source.Band.Columns.Count - 1) As Object
For Each sel In _Selections
Dim i = 0
row(i) = sel.Id : i += 1
row(i) = sel.Name : i += 1
row(i) = sel.ObjectType.GetStringValue() : i += 1
Dim uRow = source.Rows.Add(False, row, False)
uRow.Tag = sel
Next sel