-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Made OneTime bindings update on DataContext changes #17683
Merged
MrJul
merged 3 commits into
AvaloniaUI:master
from
MrJul:feature/onetime-binding-refresh
Dec 15, 2024
Merged
Made OneTime bindings update on DataContext changes #17683
MrJul
merged 3 commits into
AvaloniaUI:master
from
MrJul:feature/onetime-binding-refresh
Dec 15, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also allows null as a valid value for bindings without path
MrJul
added
bug
customer-priority
Issue reported by a customer with a support agreement.
area-bindings
labels
Dec 3, 2024
You can test this PR using the following package version. |
maxkatz6
reviewed
Dec 3, 2024
MrJul
added
the
backport-candidate-11.2.x
Consider this PR for backporting to 11.2 branch
label
Dec 11, 2024
Added as a backport candidate due to the fix for |
grokys
approved these changes
Dec 11, 2024
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Dec 11, 2024
Alexizx00789999
approved these changes
Dec 15, 2024
Alexizx00789999
approved these changes
Dec 15, 2024
Alexizx00789999
approved these changes
Dec 15, 2024
maxkatz6
pushed a commit
that referenced
this pull request
Dec 19, 2024
* Add failing tests for OneTime and null data context bindings * Made OneTime bindings update on DataContext changes Also allows null as a valid value for bindings without path * Remove now obsolete test
maxkatz6
added
backported-11.2.x
and removed
backport-candidate-11.2.x
Consider this PR for backporting to 11.2 branch
labels
Dec 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-bindings
backported-11.2.x
bug
customer-priority
Issue reported by a customer with a support agreement.
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?
This PR changes how bindings with a
OneTime
mode work, to behave the same way as in WPF (and as currently documented), updating their target not only a single time, but once per data context change.In addition,
null
data contexts are now considered valid values for bindings without a path.What is the current behavior?
OneTime
bindings are evaluated only once.Bindings without a path (
{Binding}
) are considered "pending" (they don't update their target nor call their converter) while their data context isnull
.What is the updated/expected behavior with this PR?
OneTime
bindings are evaluated once per data context, like in WPF.null
is now a validDataContext
for pathless bindings, and will use the configuredTargetNullValue
andConverter
, also matching WPF.Notes
As explained in #17587 (comment), the two changes are entangled: with the previous behavior we can't have
null
be a valid data context without breakingOneTime
bindings using them.Unit tests have been added.
One unit test has been deleted, since one-time bindings now don't stop on the first update.
Fixed issues
IsVisible
binding without a path is not applied #17587