CommunityToolkit / CommunityToolkit/Windows
Too hard to change resource values.
- Lingua principale
- C#
- Stelle
- 1.1k
- Fork
- 166
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I'll illustrate this with a specific example, but it is a broad problem.
I tried to change the SizerBaseBackgroundPointerOver brush that is used in the SizerBase control template, and found it to be almost impossible to do.
The only way to do it seems to be to make a copy of the DefaultSizerBaseStyle, rename it and rename the ThemeResources that it uses, such as SizerBaseBackgroundPointerOver. Obviously this is bad from a maintenance point of view.
Notably, it is not sufficient to just merge <ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.Sizers/SizerBase.xaml" /> into your ResourceDictionary and redefine the SizerBaseBackgroundPointerOver brush, even if you then copy in the DefaultSizerBaseStyle -- you have to also change the name of the SizerBaseBackgroundPointerOver brush within that style. It seems that resource resolution is scoped to the dictionary that defines the template (the CommunityToolkit dictionary), not to the dictionary where the style is redefined.
There really should be an easier way to do it. It is very surprising that one cannot change the default colors or other style constants anywhere in the Toolkit!
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start with CommunityToolkit.WinUI.Controls.Sizers/SizerBase.xaml, the DefaultSizerBaseStyle, and the SizerBase control template. Reproduce the documented ResourceDictionary override for SizerBaseBackgroundPointerOver and trace how the template resolves its ThemeResources. Done means consumers can change the default brush or style constants without copying and renaming the entire default style.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- desktop
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100