We used to be able to have this Data Trigger work and it still does if we were to use any of the pre-packaged themes. However we have developed our theme/style and now this data trigger no longer works for setting a row's background color. We are using alternate row color so I fail to see how to apply the possible Converter strategy as an alternate solution that I've seen in other posts.
<telerik:RadGridView Height="200" Width="545" Name="gvNoteList" Grid.Row="1" Grid.Column="1" RowStyle="{StaticResource GridViewRowStyle}" AlternateRowStyle="{StaticResource GridViewAlternateRowStyle}" Style="{StaticResource GridReadOnly}" SelectionChanged="gvNoteList_SelectionChanged">
<telerik:RadGridView.Resources>
<Style TargetType="{x:Type telerik:GridViewRow}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsSticky}" Value="True">
<DataTrigger.Setters>
<Setter Property="Background" Value="#FFFF80" />
<Setter Property="Foreground" Value="#000000" />
<Setter Property="FontSize" Value="12" />
</DataTrigger.Setters>
</DataTrigger>
</Style.Triggers>
</Style>
</telerik:RadGridView.Resources>
</telerik:RadGridView>
6 Answers, 1 is accepted
You can achieve the desired effect by having an AlternateRowStyle based on your own custom RowStyle that defines your DataTriggers like so:
<
Grid.Resources
>
<
Style
TargetType
=
"{x:Type telerik:GridViewRow}"
x:Key
=
"GridRowStyle"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding Title}"
Value
=
"Mr."
>
<
DataTrigger.Setters
>
<
Setter
Property
=
"Background"
Value
=
"#FF6394CE"
/>
</
DataTrigger.Setters
>
</
DataTrigger
>
<
DataTrigger
Binding
=
"{Binding Title}"
Value
=
"Ms."
>
<
DataTrigger.Setters
>
<
Setter
Property
=
"Background"
Value
=
"#FFE26DB4"
/>
</
DataTrigger.Setters
>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
<
Style
x:Key
=
"GridAlternateRowStyle"
BasedOn
=
"{StaticResource GridRowStyle}"
TargetType
=
"{x:Type telerik:GridViewRow}"
>
<
Setter
Property
=
"Background"
Value
=
"Gray"
/>
</
Style
>
</
Grid.Resources
>
and then just reference them from your RadGridView:
<
telerik:RadGridView
ItemsSource
=
"{Binding Customers}"
x:Name
=
"radGrid"
RowStyle
=
"{StaticResource GridRowStyle}"
AlternateRowStyle
=
"{StaticResource GridAlternateRowStyle}"
AlternationCount
=
"2"
>
Best wishes,
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

How do I set the edited cell foreground color to blue dynamically until I submit the form in WPF? I am using Telerik.RadGridView.
here is what I tried:
<telerik:GridViewDataColumn Header="New Value" DataMemberBinding="{Binding Path=NewLR}" TextWrapping="Wrap" IsReadOnly="False">
<telerik:GridViewDataColumn.CellStyle>
<Style TargetType="telerik:GridViewCell">
<Style.Triggers>
<DataTrigger Binding="{Binding HasChanged}" Value="True">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="Blue" />
</DataTrigger>
</Style.Triggers>
</Style>
</telerik:GridViewDataColumn.CellStyle>
</telerik:GridViewDataColumn>
I am sending you a sample project, which demonstrates how to achieve the desired functionality. Basically, you need to mark a cell as edited. For this reason, you can have a boolean property of your business object which will hold this information. Then you can change it when CellEditEnded event of RadGridView fires.
Regards,
Yoan
Telerik
DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

in xaml:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../Resources/StyleResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>
<converters:BooleanToColorConverter x:Key="BooleanToColorConverter"/>
<converters:CellStyleSelector x:Key="LRCellStyleSelector">
<converters:CellStyleSelector.LREditedStyle>
<Style TargetType="telerik:GridViewCell">
<Setter Property="Background" Value="Yellow"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="12"/>
</Style>
</converters:CellStyleSelector.LREditedStyle>
</converters:CellStyleSelector>
<converters:CellStyleSelector x:Key="TargetCellStyleSelector">
<converters:CellStyleSelector.TargetEditedStyle>
<Style TargetType="telerik:GridViewCell">
<Setter Property="Background" Value="Yellow"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="12"/>
</Style>
</converters:CellStyleSelector.TargetEditedStyle>
</converters:CellStyleSelector>
<converters:CellStyleSelector x:Key="URCellStyleSelector">
<converters:CellStyleSelector.UREditedStyle>
<Style TargetType="telerik:GridViewCell">
<Setter Property="Background" Value="Yellow"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="12"/>
</Style>
</converters:CellStyleSelector.UREditedStyle>
</converters:CellStyleSelector>
</ResourceDictionary>
</UserControl.Resources>
//GridViewDataColumns
<telerik:GridViewDataColumn Header="New Target" DataMemberBinding="{Binding Path=NewTarget}" IsReadOnly="False" CellStyleSelector="{StaticResource TargetCellStyleSelector}"></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="New High Limit" DataMemberBinding="{Binding Path=NewUR}" IsReadOnly="False" CellStyleSelector="{StaticResource URCellStyleSelector}"></telerik:GridViewDataColumn>
xaml.cs
private void SpecGrid_CellEditEnded(object sender, Telerik.Windows.Controls.GridViewCellEditEndedEventArgs e)
{
OperationStepInfoViewModel item = e.Cell.ParentRow.Item as OperationStepInfoViewModel;
if (item != null)
{
if (e.Cell.Column.UniqueName == "NewLR")
{
if (e.OldData.ToString() != e.NewData.ToString())
item.LRCellChanged = true;
else
item.LRCellChanged = false;
}
if (e.Cell.Column.UniqueName == "NewTarget")
{
if (e.OldData.ToString() != e.NewData.ToString())
item.TargetCellChanged = true;
else
item.TargetCellChanged = false;
}
if (e.Cell.Column.UniqueName == "NewUR")
{
if (e.OldData.ToString() != e.NewData.ToString())
item.URCellChanged = true;
else
item.URCellChanged = false;
}
}
}
CellStyleSelector.cs:
namespace SpecificationAssistant.DataConverters
{
public class CellStyleSelector : StyleSelector
{
public override Style SelectStyle(object item, DependencyObject container)
{
if (item is OperationStepInfoViewModel)
{
OperationStepInfoViewModel opsivw = item as OperationStepInfoViewModel;
Style style = new Style();
if (opsivw.LRCellChanged)
style = LREditedStyle;
if (opsivw.URCellChanged)
style = UREditedStyle;
if (opsivw.TargetCellChanged)
style = TargetEditedStyle;
return style;
}
else
return null;
}
 
public Style LREditedStyle { get; set; }
public Style TargetEditedStyle { get; set; }
public Style UREditedStyle { get; set; }
}
}
Please advise.

It was a mistake in the logic on my part. I have changed the logic by creating three separate styles for each cell and it is working great now. If there is a better solution please advise but otherwise thanks so much for your help. It is working like a charm!
This approach seems fine to me. Please, don't hesitate to ask if you need any further help.
Regards,
Yoan
Telerik
Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.