Correction for the instant binding attached behavior for WPF TextBoxes

A few days back, I had blogged about an attached property I wrote to force instant binding in a WPF TextBox. Well it turns out I was having a “duh” moment there and this was pointed out to me very politely by Richard Deeming (a fellow CodeProject author). Turns out all I needed to do was to set the UpdateSourceTrigger on the Binding to PropertyChanged. In fact, this is the very example that’s on the MSDN documentation for UpdateSourceTrigger. Oh well, you live, you learn.

<TextBox Height="23"
    Text="{Binding EnteredName, UpdateSourceTrigger=PropertyChanged}"
    HorizontalAlignment="Left"
    Margin="144,64,0,0" Name="textBoxName"
    VerticalAlignment="Top" Width="152" />

I have updated the old blog entry and pointed it to this entry.

Advertisements

One thought on “Correction for the instant binding attached behavior for WPF TextBoxes

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 )

Google+ photo

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

Connecting to %s