In RadGridView you have to handle the CellFormatting event when you want to customize the look and feel of grid cells. This is so because RadGridView uses UI virtualization. It creates elements only for cells that are currently visible - when scrolling they are reused. Of course, it will be much easier if we could access the cell directly and set its visual properties without an event.
In our next release (Q2 2010) this will be possible. By using the Style property you can set the desired background color or change the font size. Here is a sample:
].Style.BackColor = Color.Red;
All changes set this way will have a greater priority than the theme, so if you want conditional styles, you still have to use the good old CellFormatting event.
Of course you can do the same with the row:
.radGridView1.Rows.Style.BorderWidth = 3;
.radGridView1.Rows.Style.BorderColor = Color.Blue;
And, you can set the cell's read only state:
This feature is still in development, so your ideas and suggestions are more than welcome - you may as well see them implemented in the upcoming version. We will appreciate your feedback.
Nikolay Diyanov Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.
Find him on Twitter @n_diyanov or on LinkedIn.
Subscribe to be the first to get our expert-written articles and tutorials for developers!