更新整理
This commit is contained in:
@@ -6,8 +6,7 @@ using System.Windows.Markup;
|
||||
namespace WPFluent.Markup;
|
||||
|
||||
/// <summary>
|
||||
/// Provides a dictionary implementation that contains <c>WPF UI</c> controls resources used by components and other
|
||||
/// elements of a WPF application.
|
||||
/// 提供一个字典实现,其中包含 WPF 应用程序的组件和其他元素使用的 <c>WPF UI</c> 控件资源。
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="xml"> /// <Application /// xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"> ///
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
|
||||
|
||||
using System.Windows.Markup;
|
||||
|
||||
using WPFluent.Controls;
|
||||
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace WPFluent.Markup;
|
||||
|
||||
/// <summary>
|
||||
@@ -30,7 +27,7 @@ public class FontIconExtension : MarkupExtension
|
||||
{
|
||||
FontIcon fontIcon = new() { Glyph = Glyph!, FontFamily = FontFamily };
|
||||
|
||||
if(FontSize > 0)
|
||||
if (FontSize > 0)
|
||||
{
|
||||
fontIcon.FontSize = FontSize;
|
||||
}
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
|
||||
|
||||
|
||||
namespace WPFluent.Markup;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of theme resources.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="xml"> /// <ui:TextBox Foreground={ui:ThemeResource TextFillColorSecondaryBrush} /> ///</code>
|
||||
/// </example>
|
||||
public enum ThemeResource
|
||||
{
|
||||
/// <summary>
|
||||
/// Unspecified theme resource.
|
||||
/// </summary>
|
||||
Unknown,
|
||||
|
||||
// Accents
|
||||
SystemAccentColor,
|
||||
SystemAccentColorPrimary,
|
||||
SystemAccentColorSecondary,
|
||||
SystemAccentColorTertiary,
|
||||
SystemAccentColorPrimaryBrush,
|
||||
SystemAccentColorSecondaryBrush,
|
||||
SystemAccentColorTertiaryBrush,
|
||||
|
||||
AccentTextFillColorPrimaryBrush,
|
||||
AccentTextFillColorSecondaryBrush,
|
||||
AccentTextFillColorTertiaryBrush,
|
||||
|
||||
// Background
|
||||
ApplicationBackgroundColor,
|
||||
ApplicationBackgroundBrush,
|
||||
|
||||
// Focus
|
||||
KeyboardFocusBorderColor,
|
||||
KeyboardFocusBorderColorBrush,
|
||||
|
||||
// Text
|
||||
TextFillColorPrimary,
|
||||
TextFillColorSecondary,
|
||||
TextFillColorTertiary,
|
||||
TextFillColorDisabled,
|
||||
TextPlaceholderColor,
|
||||
TextFillColorInverse,
|
||||
|
||||
AccentTextFillColorDisabled,
|
||||
TextOnAccentFillColorSelectedText,
|
||||
TextOnAccentFillColorPrimary,
|
||||
TextOnAccentFillColorSecondary,
|
||||
TextOnAccentFillColorDisabled,
|
||||
|
||||
ControlFillColorDefault,
|
||||
ControlFillColorSecondary,
|
||||
ControlFillColorTertiary,
|
||||
ControlFillColorDisabled,
|
||||
ControlFillColorTransparent,
|
||||
ControlFillColorInputActive,
|
||||
|
||||
ControlStrongFillColorDefault,
|
||||
ControlStrongFillColorDisabled,
|
||||
|
||||
ControlSolidFillColorDefault,
|
||||
|
||||
SubtleFillColorTransparent,
|
||||
SubtleFillColorSecondary,
|
||||
SubtleFillColorTertiary,
|
||||
SubtleFillColorDisabled,
|
||||
|
||||
ControlAltFillColorTransparent,
|
||||
ControlAltFillColorSecondary,
|
||||
ControlAltFillColorTertiary,
|
||||
ControlAltFillColorQuarternary,
|
||||
ControlAltFillColorDisabled,
|
||||
|
||||
ControlOnImageFillColorDefault,
|
||||
ControlOnImageFillColorSecondary,
|
||||
ControlOnImageFillColorTertiary,
|
||||
ControlOnImageFillColorDisabled,
|
||||
|
||||
AccentFillColorDisabled,
|
||||
|
||||
ControlStrokeColorDefault,
|
||||
ControlStrokeColorSecondary,
|
||||
ControlStrokeColorTertiary,
|
||||
ControlStrokeColorOnAccentDefault,
|
||||
ControlStrokeColorOnAccentSecondary,
|
||||
ControlStrokeColorOnAccentTertiary,
|
||||
ControlStrokeColorOnAccentDisabled,
|
||||
|
||||
ControlStrokeColorForStrongFillWhenOnImage,
|
||||
|
||||
CardStrokeColorDefault,
|
||||
CardStrokeColorDefaultSolid,
|
||||
|
||||
ControlStrongStrokeColorDefault,
|
||||
ControlStrongStrokeColorDisabled,
|
||||
|
||||
SurfaceStrokeColorDefault,
|
||||
SurfaceStrokeColorFlyout,
|
||||
SurfaceStrokeColorInverse,
|
||||
|
||||
DividerStrokeColorDefault,
|
||||
|
||||
FocusStrokeColorOuter,
|
||||
FocusStrokeColorInner,
|
||||
|
||||
CardBackgroundFillColorDefault,
|
||||
CardBackgroundFillColorSecondary,
|
||||
|
||||
SmokeFillColorDefault,
|
||||
|
||||
LayerFillColorDefault,
|
||||
LayerFillColorAlt,
|
||||
LayerOnAcrylicFillColorDefault,
|
||||
LayerOnAccentAcrylicFillColorDefault,
|
||||
|
||||
LayerOnMicaBaseAltFillColorDefault,
|
||||
LayerOnMicaBaseAltFillColorSecondary,
|
||||
LayerOnMicaBaseAltFillColorTertiary,
|
||||
LayerOnMicaBaseAltFillColorTransparent,
|
||||
|
||||
SolidBackgroundFillColorBase,
|
||||
SolidBackgroundFillColorSecondary,
|
||||
SolidBackgroundFillColorTertiary,
|
||||
SolidBackgroundFillColorQuarternary,
|
||||
SolidBackgroundFillColorTransparent,
|
||||
SolidBackgroundFillColorBaseAlt,
|
||||
|
||||
SystemFillColorSuccess,
|
||||
SystemFillColorCaution,
|
||||
SystemFillColorCritical,
|
||||
SystemFillColorNeutral,
|
||||
SystemFillColorSolidNeutral,
|
||||
SystemFillColorAttentionBackground,
|
||||
SystemFillColorSuccessBackground,
|
||||
SystemFillColorCautionBackground,
|
||||
SystemFillColorCriticalBackground,
|
||||
SystemFillColorNeutralBackground,
|
||||
SystemFillColorSolidAttentionBackground,
|
||||
SystemFillColorSolidNeutralBackground,
|
||||
|
||||
// Brushes
|
||||
TextFillColorPrimaryBrush,
|
||||
TextFillColorSecondaryBrush,
|
||||
TextFillColorTertiaryBrush,
|
||||
TextFillColorDisabledBrush,
|
||||
TextPlaceholderColorBrush,
|
||||
TextFillColorInverseBrush,
|
||||
|
||||
AccentTextFillColorDisabledBrush,
|
||||
|
||||
TextOnAccentFillColorSelectedTextBrush,
|
||||
|
||||
TextOnAccentFillColorPrimaryBrush,
|
||||
TextOnAccentFillColorSecondaryBrush,
|
||||
TextOnAccentFillColorDisabledBrush,
|
||||
|
||||
ControlFillColorDefaultBrush,
|
||||
ControlFillColorSecondaryBrush,
|
||||
ControlFillColorTertiaryBrush,
|
||||
ControlFillColorDisabledBrush,
|
||||
ControlFillColorTransparentBrush,
|
||||
ControlFillColorInputActiveBrush,
|
||||
|
||||
ControlStrongFillColorDefaultBrush,
|
||||
ControlStrongFillColorDisabledBrush,
|
||||
|
||||
ControlSolidFillColorDefaultBrush,
|
||||
|
||||
SubtleFillColorTransparentBrush,
|
||||
SubtleFillColorSecondaryBrush,
|
||||
SubtleFillColorTertiaryBrush,
|
||||
SubtleFillColorDisabledBrush,
|
||||
|
||||
ControlAltFillColorTransparentBrush,
|
||||
ControlAltFillColorSecondaryBrush,
|
||||
ControlAltFillColorTertiaryBrush,
|
||||
ControlAltFillColorQuarternaryBrush,
|
||||
ControlAltFillColorDisabledBrush,
|
||||
|
||||
ControlOnImageFillColorDefaultBrush,
|
||||
ControlOnImageFillColorSecondaryBrush,
|
||||
ControlOnImageFillColorTertiaryBrush,
|
||||
ControlOnImageFillColorDisabledBrush,
|
||||
|
||||
AccentFillColorDisabledBrush,
|
||||
|
||||
ControlStrokeColorDefaultBrush,
|
||||
ControlStrokeColorSecondaryBrush,
|
||||
ControlStrokeColorTertiaryBrush,
|
||||
ControlStrokeColorOnAccentDefaultBrush,
|
||||
ControlStrokeColorOnAccentSecondaryBrush,
|
||||
ControlStrokeColorOnAccentTertiaryBrush,
|
||||
ControlStrokeColorOnAccentDisabledBrush,
|
||||
|
||||
ControlStrokeColorForStrongFillWhenOnImageBrush,
|
||||
|
||||
CardStrokeColorDefaultBrush,
|
||||
CardStrokeColorDefaultSolidBrush,
|
||||
|
||||
ControlStrongStrokeColorDefaultBrush,
|
||||
ControlStrongStrokeColorDisabledBrush,
|
||||
|
||||
SurfaceStrokeColorDefaultBrush,
|
||||
SurfaceStrokeColorFlyoutBrush,
|
||||
SurfaceStrokeColorInverseBrush,
|
||||
|
||||
DividerStrokeColorDefaultBrush,
|
||||
|
||||
FocusStrokeColorOuterBrush,
|
||||
FocusStrokeColorInnerBrush,
|
||||
|
||||
CardBackgroundFillColorDefaultBrush,
|
||||
CardBackgroundFillColorSecondaryBrush,
|
||||
|
||||
SmokeFillColorDefaultBrush,
|
||||
|
||||
LayerFillColorDefaultBrush,
|
||||
LayerFillColorAltBrush,
|
||||
LayerOnAcrylicFillColorDefaultBrush,
|
||||
LayerOnAccentAcrylicFillColorDefaultBrush,
|
||||
|
||||
LayerOnMicaBaseAltFillColorDefaultBrush,
|
||||
LayerOnMicaBaseAltFillColorSecondaryBrush,
|
||||
LayerOnMicaBaseAltFillColorTertiaryBrush,
|
||||
LayerOnMicaBaseAltFillColorTransparentBrush,
|
||||
|
||||
SolidBackgroundFillColorBaseBrush,
|
||||
SolidBackgroundFillColorSecondaryBrush,
|
||||
SolidBackgroundFillColorTertiaryBrush,
|
||||
SolidBackgroundFillColorQuarternaryBrush,
|
||||
SolidBackgroundFillColorBaseAltBrush,
|
||||
|
||||
SystemFillColorSuccessBrush,
|
||||
SystemFillColorCautionBrush,
|
||||
SystemFillColorCriticalBrush,
|
||||
SystemFillColorNeutralBrush,
|
||||
SystemFillColorSolidNeutralBrush,
|
||||
SystemFillColorAttentionBackgroundBrush,
|
||||
SystemFillColorSuccessBackgroundBrush,
|
||||
SystemFillColorCautionBackgroundBrush,
|
||||
SystemFillColorCriticalBackgroundBrush,
|
||||
SystemFillColorNeutralBackgroundBrush,
|
||||
SystemFillColorSolidAttentionBackgroundBrush,
|
||||
SystemFillColorSolidNeutralBackgroundBrush,
|
||||
|
||||
/// <summary>
|
||||
/// Gradient <see cref="Brush"/>.
|
||||
/// </summary>
|
||||
ControlElevationBorderBrush,
|
||||
|
||||
/// <summary>
|
||||
/// Gradient <see cref="Brush"/>.
|
||||
/// </summary>
|
||||
CircleElevationBorderBrush,
|
||||
|
||||
/// <summary>
|
||||
/// Gradient <see cref="Brush"/>.
|
||||
/// </summary>
|
||||
AccentControlElevationBorderBrush,
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
|
||||
|
||||
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace WPFluent.Markup;
|
||||
|
||||
/// <summary>
|
||||
/// Class for Xaml markup extension for static resource references.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code lang="xml"> /// <ui:Button /// Appearance="Primary" /// Content="WPF UI button with font icon" ///
|
||||
/// Foreground={ui:ThemeResource SystemAccentColorPrimaryBrush} /> ///</code> <code lang="xml"> /// <ui:TextBox
|
||||
/// Foreground={ui:ThemeResource TextFillColorSecondaryBrush} /> ///</code>
|
||||
/// </example>
|
||||
[TypeConverter(typeof(DynamicResourceExtensionConverter))]
|
||||
[ContentProperty(nameof(ResourceKey))]
|
||||
[MarkupExtensionReturnType(typeof(object))]
|
||||
public class ThemeResourceExtension : DynamicResourceExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ThemeResourceExtension"/> class.
|
||||
/// </summary>
|
||||
public ThemeResourceExtension() { ResourceKey = ThemeResource.ApplicationBackgroundBrush.ToString(); }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ThemeResourceExtension"/> class. Takes the resource key that this
|
||||
/// is a static reference to.
|
||||
/// </summary>
|
||||
public ThemeResourceExtension(ThemeResource resourceKey)
|
||||
{
|
||||
if(resourceKey == ThemeResource.Unknown)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(resourceKey));
|
||||
}
|
||||
|
||||
ResourceKey = resourceKey.ToString();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
|
||||
|
||||
|
||||
using WPFluent.Appearance;
|
||||
|
||||
using System.Windows.Markup;
|
||||
|
||||
using WPFluent.Appearance;
|
||||
|
||||
namespace WPFluent.Markup;
|
||||
|
||||
/// <summary>
|
||||
@@ -30,7 +31,6 @@ public class ThemesDictionary : ResourceDictionary
|
||||
var themeName = selectedApplicationTheme switch
|
||||
{
|
||||
ApplicationTheme.Dark => "Dark",
|
||||
ApplicationTheme.HighContrast => "HighContrast",
|
||||
_ => "Light",
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user