Uno.Themes icon indicating copy to clipboard operation
Uno.Themes copied to clipboard

Allow overriding of resources within a control's template (Lightweight Styling)

Open kazo0 opened this issue 2 years ago • 1 comments

There are currently many areas in Material and Cupertino that are hardcoding references to specific brush resources within the template of the control.

Example: The Disabled VisualState for TextBox forces the Border.Fill and PlaceholderElement.Foreground to specific brush resources. This is limiting the amount of customization that client apps should have over the default Material/Cupertino styles.

One idea would be to follow Microsoft's path for Lightweight Styling. This is already being done for certain styles, like here for the V2 FAB styles.

Another approach would be to take advantage of TemplateSettings classes, which @Xiaoy312 can explain further.

kazo0 avatar Jul 18 '22 19:07 kazo0

We are probably not going to take that 2nd approach for 2 reasons:

  1. "TemplateSettings classes provide a set of properties that are used when you define a new control template for a control."
  2. "they are calculated values coming from the basic control logic"

While 1 can be bypassed with attached property and there is counter-example for 2, it doesnt make them easily accessible for dev to alter them.

Xiaoy312 avatar Jul 18 '22 19:07 Xiaoy312

Closing this as it is now being planned/tracked here: https://github.com/unoplatform/Uno.Themes/issues/854

kazo0 avatar Oct 01 '22 13:10 kazo0