Skip to content
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

Make binding to ItemsControl.Items a compile error. #11008

Merged
merged 1 commit into from
Apr 13, 2023

Conversation

grokys
Copy link
Member

@grokys grokys commented Apr 13, 2023

What does the pull request do?

Fixes the behavior described in #10946 whereby using <ItemsControl Items="{Binding Foo}" would result in a Binding object being added to the ItemsControl.Items collection instead of resulting in a compile error.

Depends on kekekeks/XamlX#85: this PR disallows invoking "collection behavior" for property setters when using attribute syntax.

Required adding a Flyout.FlyoutPresenterClasses setter. This property was previously buggy without the setter (see #10946 (comment)). Added tests for setting classes that I put in place when investigating this.

Breaking changes

Can no longer add items to a collection in XAML using attribute syntax. This shouldn't have been possible before, but it's possible that someone was depending on it working.

Fixed issues

Fixes #10946

Depends on kekekeks/XamlX#85: this PR disallows invoking "collection behavior" for property setters when using attribute syntax.

Required adding a `Flyout.FlyoutPresenterClasses` setter. This property was previously buggy without the setter (see #10946 (comment)). Added tests for setting classes that I put in place when investigating this.

Fixes #10946
@grokys grokys changed the title Don't allow binding to ItemsControl.Items. Make binding to ItemsControl.Items a compile error. Apr 13, 2023
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0033202-beta. (feed url: https://pkgs.dev.azure.com/AvaloniaUI/AvaloniaUI/_packaging/avalonia-all/nuget/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Apr 13, 2023
Merged via the queue into master with commit 37ef8b7 Apr 13, 2023
@maxkatz6 maxkatz6 deleted the fixes/10946-dont-allow-items-binding branch April 13, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trying to bind to ItemsControl.Items instead adds a Binding to Items.
3 participants