<Style TargetType= "syncfusion:GridRowHeaderCell">
<Setter Property="Background" Value="{Binding Status,Converter={StaticResource converter }}"/>
</Style>
public class CustomConverter:IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
bool statusvalue = (bool)value;
if (statusvalue == true)
return Brushes.Red;
else
return Brushes.Green;
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
} |
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Syncfusion.Themes.Blend.WPF;Component/SfDataGrid/SfDataGrid.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:CustomConverter x:Key="converter"/>
<Style TargetType= "syncfusion:GridRowHeaderCell">
<!--By using converter the Background color is changed based on the business logic-->
<Setter Property="Background" Value="{Binding Status,Converter={StaticResource converter }}"/>
</Style>
</ResourceDictionary> |