Cell foreground color not refresh

7 posts, 0 answers
  1. trinh
    trinh avatar
    11 posts
    Member since:
    Jul 2011

    Posted 03 Mar 2013 Link to this post

    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.
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 04 Mar 2013 Link to this post

    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.

  3. trinh
    trinh avatar
    11 posts
    Member since:
    Jul 2011

    Posted 04 Mar 2013 Link to this post

    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!


  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 04 Mar 2013 Link to this post

    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.

  5. trinh
    trinh avatar
    11 posts
    Member since:
    Jul 2011

    Posted 04 Mar 2013 Link to this post

    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.
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 04 Mar 2013 Link to this post

    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.

  7. trinh
    trinh avatar
    11 posts
    Member since:
    Jul 2011

    Posted 04 Mar 2013 Link to this post

    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
Back to Top