Skip to content

Too hard to change resource values. #863

Description

@sjb-sjb

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions