-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
ThemedIcon.Properties.cs
77 lines (65 loc) · 2.7 KB
/
ThemedIcon.Properties.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
70
71
72
73
74
75
76
77
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
namespace Files.App.Controls
{
[DependencyProperty<string>("FilledIconData", nameof(OnFilledIconPropertyChanged))]
[DependencyProperty<string>("OutlineIconData", nameof(OnOutlineIconPropertyChanged))]
[DependencyProperty<Brush>("Color", nameof(OnColorPropertyChanged))]
[DependencyProperty<ThemedIconTypes>("IconType", nameof(OnIconTypePropertyChanged), DefaultValue = "ThemedIconTypes.Layered")]
[DependencyProperty<ThemedIconColorType>("IconColorType", nameof(OnIconColorTypePropertyChanged), DefaultValue = "ThemedIconColorType.None")]
[DependencyProperty<double>("IconSize", nameof(OnIconSizePropertyChanged), DefaultValue = "(double)16")]
[DependencyProperty<bool>("IsToggled", nameof(OnIsToggledPropertyChanged), DefaultValue = "false")]
[DependencyProperty<bool>("IsFilled", nameof(OnIsFilledPropertyChanged), DefaultValue = "false")]
[DependencyProperty<bool>("IsHighContrast", nameof(OnIsHighContrastPropertyChanged), DefaultValue = "false")]
[DependencyProperty<object>("Layers", nameof(OnLayersPropertyChanged))]
[DependencyProperty<ToggleBehaviors>("ToggleBehavior", nameof(OnToggleBehaviorPropertyChanged), DefaultValue = "ToggleBehaviors.Auto")]
public partial class ThemedIcon : Control
{
protected virtual void OnFilledIconPropertyChanged(string oldValue, string newValue)
{
OnFilledIconChanged();
}
protected virtual void OnOutlineIconPropertyChanged(string oldValue, string newValue)
{
OnOutlineIconChanged();
}
protected virtual void OnColorPropertyChanged(Brush oldValue, Brush newValue)
{
OnIconTypeChanged();
}
protected virtual void OnIconTypePropertyChanged(ThemedIconTypes oldValue, ThemedIconTypes newValue)
{
OnIconTypeChanged();
}
protected virtual void OnIconColorTypePropertyChanged(ThemedIconColorType oldValue, ThemedIconColorType newValue)
{
OnIconColorTypeChanged();
}
protected virtual void OnIconSizePropertyChanged(double oldValue, double newValue)
{
UpdateVisualStates();
}
protected virtual void OnIsToggledPropertyChanged(bool oldValue, bool newValue)
{
UpdateVisualStates();
}
protected virtual void OnIsFilledPropertyChanged(bool oldValue, bool newValue)
{
UpdateVisualStates();
}
protected virtual void OnIsHighContrastPropertyChanged(bool oldValue, bool newValue)
{
UpdateVisualStates();
}
protected virtual void OnLayersPropertyChanged(object oldValue, object newValue)
{
UpdateVisualStates();
}
protected virtual void OnToggleBehaviorPropertyChanged(ToggleBehaviors oldValue, ToggleBehaviors newValue)
{
UpdateVisualStates();
}
}
}