You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, this one wasn't what I thought it was going to be!
Turns out that in the example above, the template bindings don't work even in 11.0.x. The only reason that they appear to work is that the two properties you're binding: Foreground and FontSize are inherited properties. The white foreground for example isn't coming from the TemplateBinding but is being inherited from the Button. The reason the template bindings don't work is that TextBlock doesn't have a templated parent! It's not part of the Button template - it's the button content.
You can test this out by adding a Tag property on the Button and trying to sett the TextBlock.Tag using a TemplateBinding in a style. The Tag won't be set on the TextBlock in either 11.0 or 11.1.
What changed from 11.0.x to 11.1 is that the failing template bindings now cause the default property value to take effect, blocking the inherited value. That behavior was changed for normal bindings in 11.0.0 (see #10189) but TemplateBinding was missed. #13970 simply made TemplateBinding have the same behavior as normal bindings.
Given that, I think I'm going to close this with "yes it's a breaking change, but the previous behavior was a bug".
Describe the bug
Styles seem to be applied differently between 11.0.x and 11.1.x
To Reproduce
Expected behavior
On 11.0.x we get.
Text is white and bold.
What we get on master / 11.1.x
Avalonia version
11.1.x
OS
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: