Home › Forums › WinForms controls › Xceed Grid for WinForms › How to get a DataBound item from a cell or parentrow
I am evaluating using Xceed Grid instead of the standard DataGrid from Windows. However, in using the normal Windows DataGrid I am able to do things like this:
MyDataItem item = (MyDataItem ) MyGrid.Rows[e.RowIndex].DataBoundItem;
in the Paint and format events.
Is there anyway to do something like:
MyDataItem item = (MyDataItem ) e.Cells.ParentRow.DataBoundItem;
I can’t really find a way to get the databound item from the grid row or cell, so any help would be appreciated.
Imported from legacy forums. Posted by Josh (had 1151 views)
OK I actually solved it:
MyDataItem item = (MyDataItem)((DataRow) e.Cell.ParentRow).SourceObject;
in case anybody wanted to know.
Imported from legacy forums. Posted by Josh (had 1031 views)