-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Added support for Classes="{Binding StringValue}" #20182
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
base: master
Are you sure you want to change the base?
Conversation
2935419 to
1739752
Compare
|
You can test this PR using the following package version. |
500233c to
3a41ee1
Compare
|
You can test this PR using the following package version. |
|
@MrJul Could you add Questions (with my thoughts attached):
|
3a41ee1 to
05f0d22
Compare
…and Classes.Foo="{Binding}" (AvaloniaUI#18068)
05f0d22 to
ea4e15e
Compare
|
You can test this PR using the following package version. |
Fixed already existing (IsClassesBindingProperty returning incorrect name) and newly added (Class.Foo="false" failing to override Classes="Foo Bar") bugs. Changed anchor to nullable object to closer reflect underlying binding API.
|
You can test this PR using the following package version. |
|
Rebased to the Binding changes in v12. Added tests. Fixed bugs in Still willing to work on implementing the other half of the feature request ( |
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