-
Notifications
You must be signed in to change notification settings - Fork 0
/
IndexToSolidColorBrush.cs
41 lines (38 loc) · 1.39 KB
/
IndexToSolidColorBrush.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace Cannon_Simulation
{
class IndexToSolidColorBrush : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Color clr = new Color();
switch ((int)value)
{
case 0:
clr = (Color)ColorConverter.ConvertFromString("#FFed754e");
return new SolidColorBrush(clr);
case 1:
clr = (Color)ColorConverter.ConvertFromString("#FF31af28");
return new SolidColorBrush(clr);
case 2:
clr = (Color)ColorConverter.ConvertFromString("#FFed4e75");
return new SolidColorBrush(clr);
case 3:
clr = (Color)ColorConverter.ConvertFromString("#FF9b35d6");
return new SolidColorBrush(clr);
default:
case 4:
clr = (Color)ColorConverter.ConvertFromString("#FFbaed4e");
return new SolidColorBrush(clr);
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
//throw new NotImplementedException();
return null;
}
}
}