From 9a5fe6cbdffff1c09a2cd25caed02ebe83cb6391 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Sat, 29 Jan 2022 11:13:35 +0000 Subject: [PATCH] fixup --- src/Avalonia.Themes.Fluent/FluentTheme.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/FluentTheme.cs b/src/Avalonia.Themes.Fluent/FluentTheme.cs index 8625eef102..d1136d44a4 100644 --- a/src/Avalonia.Themes.Fluent/FluentTheme.cs +++ b/src/Avalonia.Themes.Fluent/FluentTheme.cs @@ -56,6 +56,10 @@ namespace Avalonia.Themes.Fluent public static readonly StyledProperty ModeProperty = AvaloniaProperty.Register(nameof(Mode)); + + public static readonly StyledProperty DensityStyleProperty = + AvaloniaProperty.Register(nameof(DensityStyle)); + /// /// Gets or sets the mode of the fluent theme (light, dark). /// @@ -64,9 +68,7 @@ namespace Avalonia.Themes.Fluent get => GetValue(ModeProperty); set => SetValue(ModeProperty, value); } - - public static readonly StyledProperty DensityStyleProperty = - AvaloniaProperty.Register(nameof(DensityStyle)); + /// /// Gets or sets the density style of the fluent theme (normal, compact). /// @@ -97,16 +99,9 @@ namespace Avalonia.Themes.Fluent { if (DensityStyle == DensityStyle.Compact) { - if ((Loaded as Styles)!.Count > 3) - { - (Loaded as Styles)![3] = _densityStyles[0]; - } - else - { - (Loaded as Styles)!.Add( _densityStyles[0]); - } + (Loaded as Styles)!.Add(_densityStyles[0]); } - else if(DensityStyle == DensityStyle.Normal) + else if (DensityStyle == DensityStyle.Normal) { (Loaded as Styles)!.Remove(_densityStyles[0]); }