maui-linux/Xamarin.Forms.Platform.GTK/ResourcesProvider.cs

52 строки
1.6 KiB
C#
Исходник Обычный вид История

2017-09-28 14:52:27 +03:00
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";
2017-09-28 14:52:27 +03:00
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)
};
}
2017-09-28 14:52:27 +03:00
private Style GetStyle(string nativeKey)
{
var result = new Style(typeof(Label));
2017-09-28 14:52:27 +03:00
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;
}
2017-09-28 14:52:27 +03:00
return result;
}
}
}