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

How to ser RowStyle programmatically

1 Answer 557 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paweł
Top achievements
Rank 1
Paweł asked on 30 Aug 2012, 10:25 AM
Hello!
How to set RadGridView RowStyle property programmatically, from code behind?

My case is to change style of all grid rows, even after conect new data source, to new style, dynamicly while using my application.
Kind regards,

1 Answer, 1 is accepted

Sort by
0
Accepted
Nick
Telerik team
answered on 04 Sep 2012, 06:26 AM
Hi Pawel,

You can build the Styles from the code behind using the Style class. Then you can add all the setters you need and set the corresponding style in the GridView you want.

Style rowStyle = new Style();
rowStyle.TargetType = typeof(GridViewRow);
rowStyle.Setters.Add(new Setter() { Property = GridViewRow.BackgroundProperty, Value = new SolidColorBrush(Colors.Green) });
 
this.GridView.RowStyle = rowStyle;

Hope this helps!  All the best,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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