Skip to content

Calling ClearValue if a color is null on WinUI is incorrect behavior #4356

@PureWeen

Description

@PureWeen

Description

nativeControl.ClearValue(property);

If a property is set via a TemplateBinding or a ThemeResource inside a ControlTemplate then calling ClearValue will just reset the property to the DP default

If the color is null then UpdateProperty should just do nothing

Steps to Reproduce

Call UpdateProperty on a Control inside ControlTemplate with a null color and you'll see it doesn't actually revert to a relevant default value

For example, when setting the TabBar we are setting the background on the following control that's set via a ThemeResource

https://github.com/microsoft/microsoft-ui-xaml/blob/991c831e4ac5b58591621f904c2f94f5a9a5bc4f/dev/NavigationView/NavigationView.xaml#L281

If the user sets the color back to null then clearing that DP doesn't re-instate the ThemeResource

Version with bug

Preview 13

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

WinUI

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Labels

fixed-in-6.0.408Look for this fix in 6.0.408!legacy-area-controlsLabel, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editorplatform/windowss/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions