Hi,
I just want to know how to change the background colour for a particular cell in XamlGrid. I want to do this in Code behind (C#). Could anyone please assist on this.
Many thanks in advance
Florence
Thanks for the information in these posts. I am using the XamDataGrid and handling the CellUpdated event. In my handler I am doing this:#
CellValuePresenter.FromCell(e.Cell).Background = Brushes.Yellow;
At first glance, this seems to work but if I scroll down I can see other cells that have been assigned the Yellow color. When I set a breakpoint I do not see the handler called for these additonal cells that get updated and turned Yellow. Seems strange. Any ideas?
Thanks.
Robert
In answer to your question - "How to refer the cells in the grid ?"I advise you to look at the following topics in the online documentation:
1. Editing Cell Values - http://help.infragistics.com/Help/NetAdvantage/WPF/2008.1/CLR3.X/html/xamData_Editing_Cell_Values.html
2. Accessing Cell Values in xamDataGrid’s RecordActivated Event - http://help.infragistics.com/Help/NetAdvantage/WPF/2008.1/CLR3.X/html/xamDataGrid_Accessing_Cell_Values_in_xamDataGrids_RecordActivated_Event.html
I also suggest you to look at the Unbound Fields sample - http://forums.infragistics.com/forums/t/11380.aspx
Best Regards,Yanko
Hi jfjuliet,
The attached ChangeCellBackgroundAtRuntime sample application contains the fullsolution implementation to your question - "How to change the background of a particular cell in the xamDataGrid ( by C# code) ?".If you have any questions, please let me know.
Many thanks for the code. However, I am struggling to refer cells in the grid. For eg, how to refer the cells in first row. Is there any method as in the flexgrid( .textmatrix(1,1) etc) ?
thanks,
Hi Florence,
i have a Code Behind for highlight a cell when this cell is select :
{
}
else
you must change the "gridContrat.SelectedItems.Cells" by your cell :)
enjoy
Nathalie