Added support for Classes="{Binding StringValue}" #20182
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Adds support for binding
Classesproperty to as string:See feature request:
Classes.bindsyntax to support enum and string bindings #18068Currently I await API review and suggestions on what to do with
<Control Classes="{Binding #ctl.Classes}">.Public API changes
Why
SetClasswas added: there's a need to differentiate betweenClassescollection modification andClasses.Foosetters/bindings in XAML, because the latter need to always overwriteClassessetter/binding.To do
Support for
<Control Classes="{Binding StringValue}" Classes.Foo="True">.Specific should override general, like it's happening currently without binding, iiuc.
Support for
<Control Classes="{Binding #ctl.Classes}">.Doing
<Control Classes="{Binding #ctl.Classes.ClassesString}">would be simple, I think, but isn't pretty. However, implicitly appending conversion to string makes behavior of<Control Classes="{Binding #ctl.Classes, Converter=...}">unclear, so maybe explicit is better.What is the current behavior?
Binding fails with a compilation error due to lack of a setter for
Classesproperty.What is the updated/expected behavior with this PR?
Now it works, but with limitations. It's currently WIP and I'll continue work if API is approved.
Some things may have broken in the process, like reordering of
ClassesandClasses.Fooproperties. Haven't tested thoroughly yet.How was the solution implemented (if it's not obvious)?
Used implementation of
Classes.Foo="{Binding BoolValue}"as a base.Initially I wanted to experiment with binding to events (#3766) but decided to try something simple first.
Checklist
Breaking changes
None planned.
Obsoletions / Deprecations
None.
Fixed issues
Fixes #18068