I'm currently using the grid.Rows.Add() method to add a new row when a particular event fires inside my application.
This works fine.
However, I am now trying to set the ForeColor of the row after I add it, but the VisualElement property is null, in the following code sample:
I have used this method successfully when inside a foreach loop, but using it doesn't seem to work as above.
Any advice or ideas?
Thanks
This works fine.
However, I am now trying to set the ForeColor of the row after I add it, but the VisualElement property is null, in the following code sample:
| int rowIdx = traysGrid.Rows.Add( |
| tray.TrayID, tray.Barcode, |
| dataContext.Locations.Where(loc => loc.LocationID == trayHistory.LocationID).First().Name |
| , |
| trayHistory.ArrivalDate, |
| AuthenticationController.GetLoggedInUserName(), |
| tray.Notes |
| ); |
| GridViewDataRowInfo row = traysGrid.Rows[rowIdx]; |
| traysGrid.GridElement.BeginUpdate(); |
| row.VisualElement.BackColor = Color.Green; |
| traysGrid.GridElement.EndUpdate(); |
I have used this method successfully when inside a foreach loop, but using it doesn't seem to work as above.
Any advice or ideas?
Thanks