/
FontImageSource.cs
40 lines (32 loc) · 1.53 KB
/
FontImageSource.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
namespace Xamarin.Forms
{
public class FontImageSource : ImageSource
{
public override bool IsEmpty => string.IsNullOrEmpty(Glyph);
public static readonly BindableProperty ColorProperty = BindableProperty.Create(nameof(Color), typeof(Color), typeof(FontImageSource), default(Color),
propertyChanged: (b,o,n)=>((FontImageSource)b).OnSourceChanged());
public Color Color {
get => (Color)GetValue(ColorProperty);
set => SetValue(ColorProperty, value);
}
public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(FontImageSource), default(string),
propertyChanged: (b, o, n) => ((FontImageSource)b).OnSourceChanged());
public string FontFamily {
get => (string)GetValue(FontFamilyProperty);
set => SetValue(FontFamilyProperty, value);
}
public static readonly BindableProperty GlyphProperty = BindableProperty.Create(nameof(Glyph), typeof(string), typeof(FontImageSource), default(string),
propertyChanged: (b, o, n) => ((FontImageSource)b).OnSourceChanged());
public string Glyph {
get => (string)GetValue(GlyphProperty);
set => SetValue(GlyphProperty, value);
}
public static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(double), typeof(FontImageSource), 30d,
propertyChanged: (b, o, n) => ((FontImageSource)b).OnSourceChanged());
[TypeConverter(typeof(FontSizeConverter))]
public double Size {
get => (double)GetValue(SizeProperty);
set => SetValue(SizeProperty, value);
}
}
}