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

Change font color of all selected rows

1 Answer 145 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 17 Apr 2013, 08:59 PM
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

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 18 Apr 2013, 06:07 AM
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.

Tags
GridView
Asked by
Eric
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or