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

Change Foreground Color does not work

1 Answer 120 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 30 Dec 2012, 11:25 PM
HI, 

I have a simple RadGridView on which I want to change the color of the text in a specific row (= 3 cells). Unfortunately, this code doesn't work:

//add new row to the grid
EventLogGrid.Items.Add(new EventLogRow(eventType, occured, msg));
 
//change the color of the text of all cells if it's an exception
if (eventType == EventLogger.EventType.Exception)
{
   var rows = this.EventLogGrid.ChildrenOfType<GridViewRow>();
   rows.Last().Foreground = new SolidColorBrush(Colors.Yellow);
}

What is wrong?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 01 Jan 2013, 03:37 PM
Hi Mike,

Unfortunately you cannot change the text foreground using this approach. You can get the Cells and set their foreground, or use the recommended approach - CellStyleSelectors.

Let me know if this will work in your case! 

All the best,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Mike
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or