dotnet / dotnet/wpf

Concerns and Suggestions Regarding the Use of DynamicResource in Win11 Theming for WPF Repository

Open
#8,599 4 comments 3 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

Dear Team,

I am writing to express my concerns about the recent changes made to the WPF repository regarding Win11 Theming, https://github.com/dotnet/wpf/discussions/8533 . I have noticed a significant increase in the use of DynamicResource in these updates.

As explained by [Harshit](https://github.com/harshit7962) in https://github.com/dotnet/wpf/pull/8579#discussion_r1434890994 , the purpose of using DynamicResource is to allow the interface content to change along with the theme. However, it is well-known that the use of DynamicResource comes with a substantial performance cost. This becomes particularly problematic when the entire theme style is filled with DynamicResource, as it can significantly slow down the performance of the entire application.

Furthermore, it is important to consider that users do not frequently change their system theme styles. This means that the use of DynamicResource could potentially slow down the performance for many users without bringing any significant benefits.

I have also noticed that [Pankaj Chaurasia](https://github.com/pchaurasia14) introduced the ApplicationThemeManager mechanism in https://github.com/dotnet/wpf/pull/8575/files#diff-53632fc5d46760e790532f11813877befa40746f4a8025857f3231ce07b214ee . I believe that the current WPF lacks a clear mechanism for following theme changes. In other words, relying on DynamicResource to implement theme changes seems to be an inefficient approach.

Therefore, I would like to suggest the introduction of a new mechanism in the WPF repository. This mechanism could replace the existing DynamicResource code and provide a more efficient way to implement style changes according to theme changes.

I believe that this new approach could significantly improve the performance of the application and provide a better user experience.

Thank you for considering my suggestions. I look forward to seeing improvements in the future updates.

Best regards,

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.