forked from Kinnara/ModernWpf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComboBoxPage.xaml.cs
69 lines (64 loc) · 2.08 KB
/
ComboBoxPage.xaml.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace ModernWpf.SampleApp.ControlPages
{
public partial class ComboBoxPage
{
public List<Tuple<string, FontFamily>> Fonts { get; } = new List<Tuple<string, FontFamily>>()
{
new Tuple<string, FontFamily>("Arial", new FontFamily("Arial")),
new Tuple<string, FontFamily>("Comic Sans MS", new FontFamily("Comic Sans MS")),
new Tuple<string, FontFamily>("Courier New", new FontFamily("Courier New")),
new Tuple<string, FontFamily>("Segoe UI", new FontFamily("Segoe UI")),
new Tuple<string, FontFamily>("Times New Roman", new FontFamily("Times New Roman"))
};
public List<double> FontSizes { get; } = new List<double>()
{
8,
9,
10,
11,
12,
14,
16,
18,
20,
24,
28,
36,
48,
72
};
public ComboBoxPage()
{
InitializeComponent();
Combo4.ItemsSource = Enumerable.Range(1, 5000).ToList();
Combo4.SelectedIndex = 0;
}
private void ColorComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string colorName = e.AddedItems[0].ToString();
Color color = default;
switch (colorName)
{
case "Yellow":
color = Colors.Yellow;
break;
case "Green":
color = Colors.Green;
break;
case "Blue":
color = Colors.Blue;
break;
case "Red":
color = Colors.Red;
break;
}
Control1Output.Fill = new SolidColorBrush(color);
}
}
}