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

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,52 @@
using WPFluent.Controls;
using System.Windows.Markup;
namespace WPFluent.Markup;
/// <summary>
/// Custom <see cref="MarkupExtension"/> which can provide <see cref="SymbolIcon"/>.
/// </summary>
/// <example>
/// <code lang="xml"> /// &lt;ui:Button /// Appearance="Primary" /// Content="WPF UI button with font icon" ///
/// Icon="{ui:SymbolIcon Symbol=Fluent24}" /&gt; ///</code> <code lang="xml"> /// &lt;ui:Button Icon="{ui:SymbolIcon
/// Fluent24}" /&gt; ///</code> <code lang="xml"> /// &lt;ui:HyperlinkButton Icon="{ui:SymbolIcon Fluent24}" /&gt;
/// ///</code> <code lang="xml"> /// &lt;ui:TitleBar Icon="{ui:SymbolIcon Fluent24}" /&gt; ///</code>
/// </example>
[ContentProperty(nameof(Symbol))]
[MarkupExtensionReturnType(typeof(SymbolIcon))]
public class SymbolIconExtension : MarkupExtension
{
public SymbolIconExtension()
{
}
public SymbolIconExtension(SymbolRegular symbol) { Symbol = symbol; }
public SymbolIconExtension(string symbol) { Symbol = (SymbolRegular)Enum.Parse(typeof(SymbolRegular), symbol); }
public SymbolIconExtension(SymbolRegular symbol, bool filled) : this(symbol) { Filled = filled; }
public override object ProvideValue(IServiceProvider serviceProvider)
{
SymbolIcon symbolIcon = new(Symbol, filled: Filled);
if (FontSize > 0)
{
symbolIcon.FontSize = FontSize;
}
return symbolIcon;
}
[ConstructorArgument("filled")]
public bool Filled { get; set; }
public double FontSize { get; set; }
[ConstructorArgument("symbol")]
public SymbolRegular Symbol { get; set; }
}