Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed theme variant properties #10310

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/Avalonia.Base/StyledElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class StyledElement : Animatable,
/// </summary>
public static readonly StyledProperty<ThemeVariant> ActualThemeVariantProperty =
AvaloniaProperty.Register<StyledElement, ThemeVariant>(
nameof(ThemeVariant),
nameof(ActualThemeVariant),
inherits: true,
defaultValue: ThemeVariant.Light);

Expand All @@ -85,9 +85,22 @@ public class StyledElement : Animatable,
/// </summary>
public static readonly StyledProperty<ThemeVariant?> RequestedThemeVariantProperty =
AvaloniaProperty.Register<StyledElement, ThemeVariant?>(
nameof(ThemeVariant),
nameof(RequestedThemeVariant),
defaultValue: ThemeVariant.Default);

/// <summary>
/// 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.
/// </summary>
/// <remarks>
/// Setting RequestedThemeVariant to <see cref="ThemeVariant.Default"/> will apply parent's actual theme variant on the current scope.
/// </remarks>
public ThemeVariant? RequestedThemeVariant
{
get => GetValue(RequestedThemeVariantProperty);
set => SetValue(RequestedThemeVariantProperty, value);
}

private static readonly ControlTheme s_invalidTheme = new ControlTheme();
private int _initCount;
private string? _name;
Expand Down
12 changes: 0 additions & 12 deletions src/Avalonia.Controls/ThemeVariantScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,5 @@ namespace Avalonia.Controls
/// </summary>
public class ThemeVariantScope : Decorator
{
/// <summary>
/// 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.
/// </summary>
/// <remarks>
/// Setting RequestedThemeVariant to <see cref="ThemeVariant.Default"/> will apply parent's actual theme variant on the current scope.
/// </remarks>
public ThemeVariant? RequestedThemeVariant
{
get => GetValue(RequestedThemeVariantProperty);
set => SetValue(RequestedThemeVariantProperty, value);
}
}
}
7 changes: 0 additions & 7 deletions src/Avalonia.Controls/TopLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,6 @@ public IBrush TransparencyBackgroundFallback
set => SetValue(TransparencyBackgroundFallbackProperty, value);
}

/// <inheritdoc cref="ThemeVariantScope.RequestedThemeVariant"/>
public ThemeVariant? RequestedThemeVariant
{
get => GetValue(RequestedThemeVariantProperty);
set => SetValue(RequestedThemeVariantProperty, value);
}

/// <summary>
/// Occurs when physical Back Button is pressed or a back navigation has been requested.
/// </summary>
Expand Down