-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathTextIconExtension.cs
More file actions
66 lines (56 loc) · 2.17 KB
/
TextIconExtension.cs
File metadata and controls
66 lines (56 loc) · 2.17 KB
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#if WINAPPSDK
using Microsoft.UI.Text;
#else
using Windows.UI.Text;
#endif
namespace CommunityToolkit.WinUI;
/// <summary>
/// An abstract <see cref="MarkupExtension"/> which to produce text-based icons.
/// </summary>
public abstract class TextIconExtension : MarkupExtension
{
/// <summary>
/// Gets or sets the size of the icon to display.
/// </summary>
public double FontSize { get; set; }
[ThreadStatic]
private static FontFamily? symbolThemeFontFamily;
/// <summary>
/// Gets the reusable "Segoe MDL2 Assets" <see cref="FontFamily"/> instance.
/// </summary>
protected static FontFamily SymbolThemeFontFamily
{
get => symbolThemeFontFamily ??= new FontFamily("Segoe Fluent Icons,Segoe MDL2 Assets");
}
/// <summary>
/// Gets or sets the thickness of the icon glyph.
/// </summary>
#if WINUI3
public Windows.UI.Text.FontWeight FontWeight { get; set; } = Microsoft.UI.Text.FontWeights.Normal;
#elif WINUI2
public Windows.UI.Text.FontWeight FontWeight { get; set; } = Windows.UI.Text.FontWeights.Normal;
#endif
/// <summary>
/// Gets or sets the font style for the icon glyph.
/// </summary>
#if WINUI3
public Windows.UI.Text.FontStyle FontStyle { get; set; } = Windows.UI.Text.FontStyle.Normal;
#elif WINUI2
public Windows.UI.Text.FontStyle FontStyle { get; set; } = Windows.UI.Text.FontStyle.Normal;
#endif
/// <summary>
/// Gets or sets the foreground <see cref="Brush"/> for the icon.
/// </summary>
public Brush? Foreground { get; set; }
/// <summary>
/// Gets or sets a value indicating whether automatic text enlargement, to reflect the system text size setting, is enabled.
/// </summary>
public bool IsTextScaleFactorEnabled { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the icon is mirrored when the flow direction is right to left.
/// </summary>
public bool MirroredWhenRightToLeft { get; set; }
}