Change Telerik GridViewCellColor based on value

You can change Gridview cell color based on a value by using CellStyleSelector in GridViewDataColumn.
First you have to add a class by inheriting StyleSelector and override SelectStyle method
public class MyStyle:StyleSelector
public override Style SelectStyle(object item, DependencyObject container)
if(item is Student)
var objEntity = item as Student;
if (objEntity.Mark > 60)
return Green;

return null;
public Style Green { get; set; }
Add a Grid Resource

<my:MyStyle x:Key="myStyle">
<Style TargetType="telerik:GridViewCell">
<Setter Property="Background" Value="Green" />



Apply the style to GridViewDataColumn CellStyleSelector Attribute

<telerik:GridViewDataColumn DataMemberBinding="{Binding Mark}" CellStyleSelector="{StaticResource myStyle}">

Happy coding…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s