diff --git a/src/Avalonia.Base/StyledElement.cs b/src/Avalonia.Base/StyledElement.cs index 5bf022cd51c..1b8a9416406 100644 --- a/src/Avalonia.Base/StyledElement.cs +++ b/src/Avalonia.Base/StyledElement.cs @@ -76,7 +76,7 @@ public class StyledElement : Animatable, /// public static readonly StyledProperty ActualThemeVariantProperty = AvaloniaProperty.Register( - nameof(ThemeVariant), + nameof(ActualThemeVariant), inherits: true, defaultValue: ThemeVariant.Light); @@ -85,9 +85,22 @@ public class StyledElement : Animatable, /// public static readonly StyledProperty RequestedThemeVariantProperty = AvaloniaProperty.Register( - nameof(ThemeVariant), + nameof(RequestedThemeVariant), defaultValue: ThemeVariant.Default); + /// + /// Gets or sets the UI theme variant that is used by the control (and its child elements) for resource determination. + /// The UI theme you specify with ThemeVariant can override the app-level ThemeVariant. + /// + /// + /// Setting RequestedThemeVariant to will apply parent's actual theme variant on the current scope. + /// + public ThemeVariant? RequestedThemeVariant + { + get => GetValue(RequestedThemeVariantProperty); + set => SetValue(RequestedThemeVariantProperty, value); + } + private static readonly ControlTheme s_invalidTheme = new ControlTheme(); private int _initCount; private string? _name; diff --git a/src/Avalonia.Controls/ThemeVariantScope.cs b/src/Avalonia.Controls/ThemeVariantScope.cs index b9724251c7c..a1629b9bab2 100644 --- a/src/Avalonia.Controls/ThemeVariantScope.cs +++ b/src/Avalonia.Controls/ThemeVariantScope.cs @@ -7,17 +7,5 @@ namespace Avalonia.Controls /// public class ThemeVariantScope : Decorator { - /// - /// Gets or sets the UI theme variant that is used by the control (and its child elements) for resource determination. - /// The UI theme you specify with ThemeVariant can override the app-level ThemeVariant. - /// - /// - /// Setting RequestedThemeVariant to will apply parent's actual theme variant on the current scope. - /// - public ThemeVariant? RequestedThemeVariant - { - get => GetValue(RequestedThemeVariantProperty); - set => SetValue(RequestedThemeVariantProperty, value); - } } } diff --git a/src/Avalonia.Controls/TopLevel.cs b/src/Avalonia.Controls/TopLevel.cs index f956fb87240..ddb697f580e 100644 --- a/src/Avalonia.Controls/TopLevel.cs +++ b/src/Avalonia.Controls/TopLevel.cs @@ -297,13 +297,6 @@ public IBrush TransparencyBackgroundFallback set => SetValue(TransparencyBackgroundFallbackProperty, value); } - /// - public ThemeVariant? RequestedThemeVariant - { - get => GetValue(RequestedThemeVariantProperty); - set => SetValue(RequestedThemeVariantProperty, value); - } - /// /// Occurs when physical Back Button is pressed or a back navigation has been requested. ///