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

Added Binding.Delay feature #16805

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TomEdwardsEnscape
Copy link
Contributor

Updates to binding sources can now be delayed by configuring each binding.

What is the updated/expected behavior with this PR?

The delay feature works in the same way as WPF's. When the target property is changed, a DispatcherTimer is started (or restarted) and the source is only updated when the timer elapses.

As with WPF, there is no delay when the source is updated via UpdateSourceTrigger.LostFocus or BindingExpressionBase.UpdateSource(). Nor is there a delay when BindingMode.OneWayToSource is active and a new source object is provided.

Other binding types

MultiBinding does not support writing back to the source, so does not have a Delay property.

TemplateBinding could support Delay but I didn't implement it there. WPF's equivalent type doesn't have it, and I also don't see a use case within the context of a ControlTemplate.

Breaking changes

None

Obsoletions / Deprecations

None

Fixed issues

Fixes #7380

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0051473-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0051481-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0052802-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054004-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

Copy link
Member

@grokys grokys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good! Just one issue I found:

If compiled bindings are disabled I get a compile-time error:

Unable to resolve suitable regular or attached property Delay on type Avalonia.Markup.Xaml:Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension

Looks like you didn't add the new property to ReflectionBindingExtension too (yes it's a bit crazy that it needs to be added here separately - it's just the way things evolved I guess).

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054075-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

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

Successfully merging this pull request may close these issues.

Delayed Binding
4 participants