优化更新代码,添加界面功能并整合

This commit is contained in:
GG Z
2025-02-10 20:53:40 +08:00
parent 83b846f15f
commit 978e03a67f
1389 changed files with 95739 additions and 22200 deletions

View File

@@ -0,0 +1,48 @@
using WPFluent.Controls;
using System.Windows.Markup;
namespace WPFluent.Markup;
/// <summary>
/// Custom <see cref="MarkupExtension"/> which can provide <see cref="FontIcon"/>.
/// </summary>
/// <example>
/// <code lang="xml"> /// &lt;ui:Button /// Appearance="Primary" /// Content="WPF UI button with font icon" ///
/// Icon="{ui:FontIcon '&#x1F308;'}" /&gt; ///</code> <code lang="xml"> /// &lt;ui:Button Icon="{ui:FontIcon
/// '&amp;#x1F308;'}" /&gt; ///</code> <code lang="xml"> /// &lt;ui:HyperlinkButton Icon="{ui:FontIcon '&amp;#x1F308;'}"
/// /&gt; ///</code> <code lang="xml"> /// &lt;ui:TitleBar Icon="{ui:FontIcon '&amp;#x1F308;'}" /&gt; ///</code>
/// </example>
[ContentProperty(nameof(Glyph))]
[MarkupExtensionReturnType(typeof(FontIcon))]
public class FontIconExtension : MarkupExtension
{
public FontIconExtension()
{
}
public FontIconExtension(string glyph) { Glyph = glyph; }
public override object ProvideValue(IServiceProvider serviceProvider)
{
FontIcon fontIcon = new() { Glyph = Glyph!, FontFamily = FontFamily };
if(FontSize > 0)
{
fontIcon.FontSize = FontSize;
}
return fontIcon;
}
[ConstructorArgument("fontFamily")]
public FontFamily FontFamily { get; set; } = new("FluentSystemIcons");
public double FontSize { get; set; }
[ConstructorArgument("glyph")]
public string? Glyph { get; set; }
}