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
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