CommunityToolkit / CommunityToolkit/Windows

Too hard to change resource values.

Offen
#863 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C#
Sterne
1.1k
Forks
166
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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!

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
desktop
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.