This is a migrated thread and some comments may be shown as answers.

Cell foreground color not refresh

6 Answers 189 Views
GridView
This is a migrated thread and some comments may be shown as answers.
trinh
Top achievements
Rank 1
trinh asked on 04 Mar 2013, 03:07 AM
I use a RadGridView control with custom cell using CellTemplateSelector.

In RowLoaded event, i set foreground color of cell, but when i run my application, the cell foreground is not applied.
When i scroll the vertical scroll --> the foreground color is changed.

--> thank to tell me how to fix this bug.

6 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 04 Mar 2013, 08:38 AM
Hello,

Since the virtualization of RadGridView is turned on by default, it is not recommended to work with the visual elements and their properties. I would recommend you to work with the data elements instead. You can take a look at this article for a reference on how to use CellTemplateSelector.

Please let me know if you can apply this approach to your scenario. 
 

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
trinh
Top achievements
Rank 1
answered on 04 Mar 2013, 09:36 AM
Hi  Didie,

Thank for your answer quickly.

i read your reference article before. The apply CellTemplateSelector is ok.
I must change cell foreground color in RowLoaded event because i need check the value of other cell in same row to detect color.

please help me!


0
Dimitrina
Telerik team
answered on 04 Mar 2013, 09:41 AM
Hello,

You say that you must change cell foreground color based on the value of other cell in same row. Why don't you work with the bound data item (for the row)? You could access all the values from the bound item ("club" in the help article) and based on them decide what foreground color to return.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
trinh
Top achievements
Rank 1
answered on 04 Mar 2013, 11:13 AM
i can not bound data item because the number column of grid is dynamic. I do not know the correct number column, column header of grid. My custom grid shall be used in more screens in code. The column data of these screens are different.
0
Dimitrina
Telerik team
answered on 04 Mar 2013, 11:35 AM
Hello,

How do you decide what foreground color to return when the RowLoaded event is raised? Is it possible to apply similar logic with the TemplateSelector?
 

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
trinh
Top achievements
Rank 1
answered on 05 Mar 2013, 01:58 AM
we shall check the all cells of row. if it is in a specific column (detect by column header) --> get value of this cell and set foreground color of all other cells of this row based on this value.

Note:
- the specific column maybe not existed --> in this case, do not change foreground color of other cells
- the number column of grid and column header is dynamic and different for each screen
Tags
GridView
Asked by
trinh
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
trinh
Top achievements
Rank 1
Share this question
or