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

[Solved] cell font colour

1 Answer 116 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Wisam Mahdi
Top achievements
Rank 1
Wisam Mahdi asked on 17 Nov 2009, 10:53 PM
Hi ...
how can I change the font colour of a specific cell in the code, I know I can do this in the wpf version , is it possible in the silverlight version?? ..

Thanks
Wisam

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 19 Nov 2009, 04:08 PM
Hi Wisam Mahdi,

You can use RowLoaded event to get every cell for which you want to change the foreground color. The example code below changes foreground of all cells that belongs to a "LastName" column.

void radGridView_RowLoaded(object sender, RowLoadedEventArgs e)
        {
                if ((e.Row != null) && !(e.Row is GridViewHeaderRow))
                {
                    GridViewCell cell = e.Row.Cells.Cast<GridViewCell>().FirstOrDefault(c => c.Column.UniqueName == "LastName");
                    if (cell != null)
                    {
                        cell.Foreground = new SolidColorBrush(Colors.Red);
                    }
                }
        }

 Hope this helps.

Regards,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Wisam Mahdi
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or