This repository was archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathResourcesProvider.cs
51 lines (46 loc) · 1.6 KB
/
ResourcesProvider.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
using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.GTK
{
internal class ResourcesProvider : ISystemResourcesProvider
{
private const string TitleStyleKey = "HeaderLabelStyle";
private const string SubtitleStyleKey = "SubheaderLabelStyle";
private const string BodyStyleKey = "BodyLabelStyle";
private const string CaptionStyleKey = "CaptionLabelStyle";
private const string ListItemDetailTextStyleKey = "BodyLabelStyle";
private const string ListItemTextStyleKey = "BaseLabelStyle";
public IResourceDictionary GetSystemResources()
{
return new ResourceDictionary
{
[Device.Styles.TitleStyleKey] = GetStyle(TitleStyleKey),
[Device.Styles.SubtitleStyleKey] = GetStyle(SubtitleStyleKey),
[Device.Styles.BodyStyleKey] = GetStyle(BodyStyleKey),
[Device.Styles.CaptionStyleKey] = GetStyle(CaptionStyleKey),
[Device.Styles.ListItemDetailTextStyleKey] = GetStyle(ListItemDetailTextStyleKey),
[Device.Styles.ListItemTextStyleKey] = GetStyle(ListItemTextStyleKey)
};
}
private Style GetStyle(string nativeKey)
{
var result = new Style(typeof(Label));
switch (nativeKey)
{
case TitleStyleKey:
result.Setters.Add(new Setter { Property = Label.FontSizeProperty, Value = 24 });
break;
case SubtitleStyleKey:
result.Setters.Add(new Setter { Property = Label.FontSizeProperty, Value = 20 });
break;
case BodyStyleKey:
result.Setters.Add(new Setter { Property = Label.TextColorProperty, Value = Color.Blue });
break;
case CaptionStyleKey:
break;
case ListItemTextStyleKey:
break;
}
return result;
}
}
}