I am trying to get brush color from red to green by passing %.I have a datagrid each row has a percentage value. Is there any function like getColor(Red,Green,%) which return the color from red to green a/c to %.
Asked
Active
Viewed 247 times
0
-
1Welcome to SO. What research have you done? [ask]. Good luck. – Oct 03 '16 at 06:41
-
[This](http://stackoverflow.com/q/9650049/3670437) question might help you. – Yusuf Tarık Günaydın Oct 03 '16 at 08:21
1 Answers
0
You need to looking for a converter, that is a class that implements IValueConverter interface. You need to work with WPF binding.
public class BackgroundConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Brush someBrush;
// Put here your logic
return someBrush;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}

Igor Damiani
- 1,897
- 9
- 12