TextBox and Data Binding in WPF

Have you run into situations where you need your data-bound textbox update the underlying data automatically while you are typing? So when you hit the ‘Enter’ key, your keyboard event handler can examine the entered data right away?

Here is one of the ways to do it:

<TextBox Text=“{Binding YourDataSource, UpdateSourceTrigger=PropertyChanged }”

The key is to use the “PropertyChanged” binding behavior. For a more complete review of UpdateSourceTrigger, you can take a look at its MSDN document. Now I wish the Visual Studio 2008 XAML editor can do IntelliSense of this while I am manually entering the data binding codes. It can at least save me 5 min research time 🙂

The Cider designer in Visual Studio 2008 still has a very long way to go to match what Windows Forms designer offers now in Visual Studio 2005.


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 )

Google photo

You are commenting using your Google 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

%d bloggers like this: