Skip to content
Merged
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
19 changes: 13 additions & 6 deletions src/Wpf.Ui/UiApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ public Window? MainWindow
}
}

/// <summary>
/// Gets or sets a value indicating whether <see cref="UiApplication" /> applies
/// system accent color when first accessing <see cref="Resources" /> property
/// </summary>
public bool ApplySystemAccentColor { get; set; } = true;

/// <summary>
/// Gets or sets the application's resources.
/// </summary>
Expand All @@ -90,7 +96,11 @@ public ResourceDictionary Resources

try
{
Wpf.Ui.Appearance.ApplicationAccentColorManager.ApplySystemAccent();
if (ApplySystemAccentColor)
{
Wpf.Ui.Appearance.ApplicationAccentColorManager.ApplySystemAccent();
}

var themesDictionary = new Markup.ThemesDictionary();
var controlsDictionary = new Markup.ControlsDictionary();
_resources.MergedDictionaries.Add(themesDictionary);
Expand All @@ -101,13 +111,10 @@ public ResourceDictionary Resources

return _application?.Resources ?? _resources;
}

set
{
if (_application is not null)
{
_application.Resources = value;
}

_application?.Resources = value;
_resources = value;
}
}
Expand Down
Loading