WPF Reflections

Mar 4 2008   5:56PM GMT

Controlling how the source is updated in a binding

Mark Shurmer Profile: MarkWPF

Have you ever wondered how to alter the update frequency of a binding?
Probrably like me, you use the default settings unless you notice something not working

What am I talking about?
Well, when you have a binding defined to another element for example:

<TextBox Name=”txtFirstOne” />
<TextBox Text=”{Binding ElementName=txtFirstOne, Path=Length” Name=”txtFontSize” />

The second textbox will display the length of the text in the first textbox, as you type. Well actually it doesn’t, as the target is not being updated. To fix that you could add UpdateSourceTrigger=PropertyChanged for this example, and bingo:

<TextBox Text=”{Binding ElementName=txtFirstOne, Path=Length, UpdateSourceTrigger=PropertyChanged” Name=”txtFontSize” />

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: