// based on Nodelevel and RowIndex, you can apply the background color
internal class StyleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if((value as TreeGridRowControl).DataRow.Level == 0)
return new SolidColorBrush(Colors.SkyBlue);
if (((value as TreeGridRowControl).DataRow.RowIndex %2 ==0) && ((value as TreeGridRowControl).DataRow.Level !=0))
return new SolidColorBrush(Color.FromArgb(255, 255, 211, 86));
else if (((value as TreeGridRowControl).DataRow.RowIndex % 2 != 0) && ((value as TreeGridRowControl).DataRow.Level !=0))
return new SolidColorBrush(Colors.Bisque);
else
return new SolidColorBrush(Color.FromArgb(255, 112, 252, 160));
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
|