-
Notifications
You must be signed in to change notification settings - Fork 1
/
ThemeItem.cs
45 lines (37 loc) · 978 Bytes
/
ThemeItem.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
using System.ComponentModel;
namespace ThemeSelector
{
public sealed class ThemeItem : ObservableObject
{
bool? _isChecked;
readonly Action<ThemeItem> _action;
public ThemeItem(string text, Action<ThemeItem> action, AppTheme value)
{
Theme = value;
Text = text;
_action = action;
}
#region Properties
public AppTheme Theme
{
get;
}
public string Text
{
get;
}
public bool IsChecked
{
get => _isChecked == true;
set
{
if (SetProperty(ref _isChecked, value, IsSelectedChangedEventArgs))
{
_action.Invoke(this);
}
}
}
#endregion Properties
static readonly PropertyChangedEventArgs IsSelectedChangedEventArgs = new(nameof(IsChecked));
}
}