Change font color of all selected rows

2 posts, 1 answers
  1. Eric
    Eric avatar
    24 posts
    Member since:
    Sep 2008

    Posted 17 Apr 2013 Link to this post

    Hi, I have a project where I synchronize multiple controls. The RadGridView control is bound to an observable collection of data. Whenever I need to select multiple items, I execute
    grid.UnselectAll();
    grid.SelectedItems.Add(element);
    .... do this for all selected elements .....

    The grid does what it's suppose to do, however, I need to customize all selected rows to have blue font color. At first I tried using
    grid.ItemContainerGenerator.ContainerFromItem(item) as GridViewRow

    However I quickly learned that this will only work for rows currently visible (based on some other threads I have read). The item itself does not have any kind of "IsSelected" property, so customizing styles probably will not work. I am looking for a c#-based code solution to find all necessary rows and change the Foreground property.

    Thanks in advance
  2. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 18 Apr 2013 Link to this post

    Hello Eric,

    My recommendation would be to modify the style for the selected state of the row. Please check out this article for more information. 

    All the best,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top