Ensure existing Margin and Effect setters are removed from
newWindowBorderStyle before adding new ones. This prevents
duplicate property setters and ensures only the latest values
are applied.
Refactored ThemeHelper.CopyStyle to assign the target style's BasedOn property directly from the original style, instead of recursively copying base style properties. This reduces complexity and ensures correct style inheritance.
Replaced direct calls to CopyStyle with ThemeHelper.CopyStyle in Theme.cs. This centralizes style copying logic and improves code organization and maintainability.
Renamed the method GetFreezeSolidColorBrush to GetFrozenSolidColorBrush in ThemeHelper.cs for improved naming consistency. Updated all references in Theme.cs accordingly. No changes to functionality.
Moved the CopyStyle method from Theme to a new static ThemeHelper class for better code organization and reusability. Updated all references in Theme to use ThemeHelper.CopyStyle. Added ThemeHelper.cs and necessary using directives.
Introduce ThemeHelper.GetFreezeSolidColorBrush to centralize and reuse SolidColorBrush creation and freezing logic. Refactor Theme.cs to use this helper, improving code clarity and maintainability. Also, use Brushes.Transparent directly where appropriate.
Refactor drop shadow effect logic to create a new Style instance instead of modifying the existing one in-place. This approach copies all relevant resources, triggers, and setters, updating only the Margin and Effect as needed. The new Style is applied at the application level, improving robustness for theme switching and preventing issues with sealed or shared Style objects.
Refactored Theme.cs to improve theme blur and dark mode handling:
- Replaced static IsBlurTheme() with IsThemeBlurEnabled(dict) for per-theme blur detection.
- Updated all blur checks to use the new method.
- Improved code style, readability, and comments.
- Moved system dark mode registry check to only run when needed.
- Ensured blur and dark mode are applied based on theme and user/system preferences.