Where is my Binding UpdateSourceTrigger= PropertyChanged on WP7 Silverlight ?

WTF! Where is the UpdateSourceTrigger= PropertyChanged on WP7 Silverlight? J

I got surprised when I saw that there was no PropertyChanged option on the UpdateSourceTrigger… All I could see was Default and Explicit…

The Default behavior works like our “LostFocus” from WPF, where the value is updated only when the control loses focus. This works most of the time, but there will be situations that you need the value to get updated as soon as the control values changes (equivalent to PropertyChanged).

To achieve this behavior you will need to do:

Set the UpdateSourceTrigger to Explicit

When you say that it is “explicit”, basically you will have to handle it…. Next step is to add one event handler to your bound control. On my sample it is a TextBox.

On the event handler comes the magic:


private void TextChangedUpdateTrigger(object sender, TextChangedEventArgs e)
  TextBox txtbox = sender as TextBox;
BindingExpression bindingExpression = txtbox.GetBindingExpression(TextBox.TextProperty);

The code above sets the binding explicitly! Great!!(or not so if you know what I mean) Anyway, this will give you the “PropertyChanged” like behavior…

That’s it for now!

BTW I found this solution on the very nice free book
Programming Windows Phone 7 from Charles Petzold. Read the whole book or jump to page 387 to know about this issue in particular.

Posted on 28.05.2011, in Step-By-Step. Bookmark the permalink. 2 Comments.

  1. It acts immediately on all your garage concerns as quickly as possible.
    This article will take you through the steps to safely remove the hinge and roller assembly and replace the roller.

    Many home improvement stores carry Wayne Dalton parts and
    doors so they would have additional resources for you.

  2. Hi there, I desjre to subscribe for this blog to obtain hottest updates, therefoe where can i do it
    please help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: