-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implemented Application.ThemeMode and Window.ThemeMode properties #9436
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
Merged
dipeshmsft
merged 15 commits into
dotnet:main
from
dipeshmsft:fluent/implement-theme-properties
Jul 22, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2833161
Implemented ThemeMode properties and struct
dipeshmsft cd56d77
Added ThemeModeConverter
dipeshmsft 5ee74e2
Made ThemeModeConverter internal
dipeshmsft e88624f
Added Experimental Attribute on ThemeMode struct and properties
dipeshmsft e6e8a09
Implemented ThemeMode and Resources syncing
dipeshmsft b1d31e1
Resolved PR comments
dipeshmsft 971504a
Fixing sync when only RD is included at first position
dipeshmsft 1aaee53
Adding None case invalid return
harshit7962 bb9496c
Regenerating Fluent files and added ref assembly changes
dipeshmsft d5a65a7
Merge branch 'fluent/implement-theme-properties' of https://github.co…
dipeshmsft 61a5e32
Removed extra changes in Fluent theme files
dipeshmsft a865345
Added caching of app theme state to avoid multiple reloads on same th…
dipeshmsft 568addf
Made ThemeModeConverter public and refactored classes
dipeshmsft 01cc071
Removed old ThemeManager and renamed ThemeManager3 -> ThemeManager
dipeshmsft 998c4a4
Added ThemeModeConverter to reference assembly and refactored code
dipeshmsft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" /> | ||
<PropertyGroup> | ||
<NoWarn>$(NoWarn);CA1420</NoWarn> | ||
<NoWarn>$(NoWarn);CA1420;WPF0001</NoWarn> | ||
</PropertyGroup> | ||
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/Microsoft.DotNet.Wpf/src/Pre
10000
sentationFramework/System/Windows/FluentThemeState.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System; | ||
using System.ComponentModel; | ||
|
||
using System.ComponentModel.Design.Serialization; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
using System.Reflection; | ||
using System.Windows; | ||
using System.Windows.Markup; | ||
using System.Windows.Media; | ||
using System.Security; | ||
using MS.Internal; | ||
using MS.Utility; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace System.Windows | ||
{ | ||
internal readonly struct FluentThemeState : IEquatable<FluentThemeState> | ||
{ | ||
|
||
public FluentThemeState(string themeName, bool useLightColors, Color accentColor) | ||
{ | ||
_themeName = themeName; | ||
_useLightColors = useLightColors; | ||
_accentColor = accentColor; | ||
} | ||
|
||
public FluentThemeState(string themeName, bool useLightColors) | ||
{ | ||
_themeName = themeName; | ||
_useLightColors = useLightColors; | ||
_accentColor = SystemColors.AccentColor; | ||
} | ||
|
||
public string ThemeName => _themeName; | ||
public bool UseLightColors => _useLightColors; | ||
public Color AccentColor => _accentColor; | ||
|
||
private readonly string _themeName; | ||
private readonly bool _useLightColors; | ||
private readonly Color _accentColor; | ||
|
||
|
||
public bool Equals(FluentThemeState other) | ||
{ | ||
return string.Equals(ThemeName, other.ThemeName, StringComparison.Ordinal) && | ||
UseLightColors == other.UseLightColors && | ||
AccentColor == other.AccentColor; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
return obj is FluentThemeState other && Equals(other); | ||
} | ||
|
||
public static bool operator ==(FluentThemeState left, FluentThemeState right) | ||
{ | ||
return left.Equals(right); | ||
} | ||
|
||
public static bool operator !=(FluentThemeState left, FluentThemeState right) | ||
{ | ||
return !left.Equals(right); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return StringComparer.Ordinal.GetHashCode(ToString()); | ||
} | ||
|
||
|
||
public override string ToString() | ||
{ | ||
return $"ThemeName: {ThemeName}, UseLightColors: {UseLightColors}, AccentColor: {AccentColor}"; | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.