-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.cs
82 lines (80 loc) · 2.81 KB
/
App.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
78
79
80
81
82
namespace MauiArcgisTest
{
public partial class App : Application
{
public App()
{
Build();
MainPage = new MainPage();
}
private void Build()
{
Resources.Add(new Colors());
Resources.Add(new Styles());
Resources.Add("MauiLabel", new Style(typeof(Label))
{
Setters =
{
new()
{
Property = Label.TextColorProperty,
Value = AppInfo.RequestedTheme switch { AppTheme.Dark => AppResource<Color>("White"), _ => AppResource<Color>("Primary") }
},
},
});
Resources.Add("Action", new Style(typeof(Button))
{
Setters =
{
new()
{
Property = Button.BackgroundColorProperty,
Value = AppInfo.RequestedTheme switch { AppTheme.Dark => AppResource<Color>("BackgroundDark"), _ => AppResource<Color>("BackgroundLight") }
},
new()
{
Property = Button.TextColorProperty,
Value = AppInfo.RequestedTheme switch { AppTheme.Dark => AppResource<Color>("TextDark"), _ => AppResource<Color>("TextLight") }
},
new()
{
Property = Button.FontFamilyProperty,
Value = AppResource<string>("AppFont")
},
new()
{
Property = Button.FontSizeProperty,
Value = AppResource<double>("AppFontSize")
},
new()
{
Property = Button.PaddingProperty,
Value = new Thickness(14,10)
},
},
});
Resources.Add("PrimaryAction", new Style(typeof(Button))
{
BasedOn = AppResource<Style>("Action"),
Setters =
{
new()
{
Property = Button.BackgroundColorProperty,
Value = AppResource<Color>("Primary")
},
new()
{
Property = Button.FontAttributesProperty,
Value = FontAttributes.Bold
},
new()
{
Property = Button.TextColorProperty,
Value = AppResource<Color>("White")
},
},
});
}
}
}