-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.cs
48 lines (47 loc) · 1.51 KB
/
MainWindow.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
using System.Windows;
using System.Collections.ObjectModel;
using DevExpress.Mvvm;
using System.Windows.Media;
using DevExpress.Xpf.Grid;
namespace DXGridSample {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
}
public class ViewModel : BindableBase {
public ObservableCollection<string> Countries {
get { return GetValue<ObservableCollection<string>>(); }
set { SetValue(value); }
}
public ObservableCollection<Item> Items {
get { return GetValue<ObservableCollection<Item>>(); }
set { SetValue(value); }
}
public bool HighlightVisited {
get { return GetValue<bool>(); }
set { SetValue(value); }
}
public ViewModel() {
Countries = new ObservableCollection<string> { "USA", "Germany", "Russia" };
Items = new ObservableCollection<Item>();
int i = 0;
foreach (var country in Countries)
Items.Add(new Item { Country = country, Visits = i++ });
}
}
public class Item : BindableBase {
public string Country {
get { return GetValue<string>(); }
set { SetValue(value); }
}
public int Visits {
get { return GetValue<int>(); }
set { SetValue(value); }
}
public Color Color {
get { return GetValue<Color>(); }
set { SetValue(value); }
}
}
}