-
-
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
UpdateSourceTrigger #7797
UpdateSourceTrigger #7797
Conversation
You can test this PR using the following package version. |
You can test this PR using the following package version. |
Maybe you can add an example to BindingDemo? (side note: styles are broken in there, can probably switch to fluent theme). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a brief review. It seems UpdateSource
might be a Pandora's box but in general having it would help writing controllable binding code.
…into updatesourcetrigger
To be honest, I think we need to wait until #5831 is merged in order to do this properly, because this feature breaks the layering we currently have. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments, but unable to get much further with the review because there seems to be a problem with the PR as evidenced by the failing tests.
My main concern here will be that of performance, and adding the additional explicitSourceUpdate
observable is probably going to add a bit of weight - especially as it uses rx operators which we shouldn't really be using at this low level due to their lousy performance.
# Conflicts: # src/Avalonia.Base/ApiCompatBaseline.txt
…into updatesourcetrigger
Decided to remove Anyways, ran some benchmarks and it seems that this PR improves bindings a bit: Master
This PR
|
@pr8x wanted to take a look at this, but seems a bunch of binding unit tests are failing? |
…into updatesourcetrigger
You can test this PR using the following package version. |
@grokys UTs fixed. |
@pr8x Our product is being ported from WPF and needs We can work around the lack of these options these by creating proxy properties and assigning values or bindings to them at times of our choosing, but this is an ugly hack that can cause confusion among control consumers. Have you seen the method Between the myControl.GetBindingExpression(Control.MyProperty).UpdateTarget(); Use case for
|
Hi guys, Thanks in advance. |
Also would like to see an update on the status here. @pr8x Are you waiting for core maintainer feedback? It would be great to get this in for 11.0. |
I'm kinda 👎 on merging this PR right now for a couple of reasons:
In the absence of more unit tests, I'd be ok with merging if it'd had extensive testing. I think I asked you a while ago @pr8x if you'd tested this in your product and you hadn't yet. Have you had chance to test it now? |
@grokys I did test it in one scenario and it was working fine. At this point this PR was stagnant waiting for review that we might as well close it and wait for the refactoring of the bindings. Current binding system seems messy anyway relying way too much on observables/LINQ selectors. |
Ok, lets close this and I'll get started on refactoring the binding system soon. |
Hello, |
What does the pull request do?
Implement WPF's
UpdateSourceTrigger
(https://docs.microsoft.com/en-us/dotnet/api/system.windows.data.binding.updatesourcetrigger?view=windowsdesktop-6.0)TODO:
I need a proper interface for getting focus loss event inside Avalonia.Base. Any ideas? There could be someIUpdateSourceTriggerLostFocusProvider
or something. Right now I am just checking for "IsFocused" property (by name) which is not a good solution for obvious reasons.What is the current behavior?
It's not supported.
Checklist
Breaking changes
Most important ones:
InstancedBinding.ctor()
InstancedBinding.TwoWay()
InstancedBinding.OneWayToSource()
These could be defaulted to
UpdateSourceTrigger.Default
though.Fixed issues
Fixes #3754