Delay property for Binding

I’ve recently discovered a very useful property that’s been available since .NET 4.5, called Delay. It’s used in the XAML when binding a property, and it delays sending the binding back to the ViewModel for the number of milliseconds that you specify. For example…

<TextBox x:Name="TextBoxSearch"
  Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged, Delay=1000}" />

In this example, the SearchText property will not get updated as soon as the user types, but rather will wait 1 second from when the user finishes typing to update the property. This is beneficial when you have a service call, or search method that is triggered when the bound property is changed.

Here are two links that describe the usage and functionality very well:

Be First to Comment

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.