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

Porting WPF UpdateSourceTrigger #3754

Closed
pr8x opened this issue Apr 7, 2020 · 9 comments · Fixed by #13970
Closed

Porting WPF UpdateSourceTrigger #3754

pr8x opened this issue Apr 7, 2020 · 9 comments · Fixed by #13970

Comments

@pr8x
Copy link
Contributor

pr8x commented Apr 7, 2020

Having something like the WPF Binding.UpdateSourceTrigger (https://docs.microsoft.com/en-us/dotnet/api/system.windows.data.binding.updatesourcetrigger?view=netframework-4.8) in Avalonia would be helpful.

@mightypanda
Copy link

The missing UpdateSourceTrigger is a headache in some scenarios:
for example:

  • if you bind a numeric value to a visual property, you get unpleasant looking updates in the visual/shape while typing the number.
  • If binding fires up a server-sync, the server gets many more calls that are basically useless, as well as validation errors

@maxkatz6
Copy link
Member

If binding fires up a server-sync, the server gets many more calls that are basically useless, as well as validation errors

This part is expected to be managed on lower layer and not by View. With ReactiveUI it's quite simple using Throttle mechanism. It's always possible with some other third-parties.

if you bind a numeric value to a visual property, you get unpleasant looking updates in the visual/shape while typing the number.

Agree, in some cases for binging between elements we care only about final value after lostfocus, so UpdateSourceTrigger will be really helpful in this case.

@mightypanda
Copy link

Yes, throttling can help but it is not semantically the same, also for client->server updates it makes sense the whole data is sent as soon as the field gets a input confirmation from the user, which is often modeled as a LostFocus event.

@loonwong
Copy link

Hello,

Is this feature in your roadmap? is there a chance to see it in the next release?

@kekekeks
Copy link
Member

For now you can use behaviors for a workaround.

        <TextBox>
            <Interaction.Behaviors>
                <example:LostFocusUpdateBindingBehavior Text="{Binding Text}"/>
            </Interaction.Behaviors>
        </TextBox>

It's a bit more verbose, but should solve your issue.

@pr8x
Copy link
Contributor Author

pr8x commented Mar 14, 2022

Made a PR for this: #7797

@workgroupengineering
Copy link
Contributor

Hi @Avaloniateam, is there any chance that the feature will be implemented? It's very annoying to add behaviors.

@MikeCodesDotNET
Copy link
Member

There is a plan to look at the binding system but right now we're focused on shipping v11.

@heartacker
Copy link
Contributor

There is a plan to look at the binding system but right now we're focused on shipping v11.

thanks and add this to milestone V11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants