-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use LocalValue priority for values in ControlTemplate #7679
Conversation
Add tests to check that template values are assigned with Style priority and move other XAML control template tests alongside it in a new test class.
Allow markup extensions to detect whether they're in a control template and use that info in `DynamicResourceExtension` to use `Style` priority.
You can test this PR using the following package version. |
What does it do? |
What's the status on this PR? Couple comments to the questions:
I would expect anything within a ControlTemplate to have a Can you set an explicit priority in Xaml, or is this another Markup.Declarative issue? If so, no offense to them, but getting around these issues in C# is a lot easier than Xaml and I would say make everything template priority.
This would probably make sense to do IMO |
Understandable, but not great. I hope this and the styling system upgrades are still in the queue for 11.0. Probably reciting the obvious here, but the longer these upgrades wait, the harder it becomes to make the change. |
…ate-binding-priority
You can test this PR using the following package version. |
Now that #8479 has been merged, this PR can be merged too. We will probably want to think about changing the |
You can test this PR using the following package version. |
What does the pull request do?
We have an ongoing source of confusion in Avalonia in that values set in a control template are set using
LocalValue
priority meaning that they can't be overridden by style setters (to be fair, WPF/UWP have this too but it's less noticeable due to their styling system).This PR changes the XAML compiler to set literal values,
StaticResource
s andDynamicResource
s withTemplatedParent
priority, meaning that the values can be overridden in styles which have a trigger selector.Questions
TemplatedParent
priority to indexer bindings (we already have[~Foo.Bar]
syntax) but how would e.g.Avalonia.Markup.Declarative
do this?{Binding}
s - should they change their priority inControlTemplate
s? What if they have an explicitPriority
already set?TemplatedParent
priority going to be OK here? I think it is, but I may have missed something. Do we need a separate priority?TemplatedParent
priority to simplyTemplate
?Breaking changes
Styles which had non-working overrides of control template values will now come alive and potentially mess things up (you can see such a problem in the
HamburgerMenu
control in ControlCatalog here).Fixed issues
Fixes #2789