--- title: "How to: Control When the TextBox Text Updates the Source" description: Control the timing of binding source updates using the UpdateSourceTrigger property in Windows Presentation Foundation (WPF). ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "source updates [WPF], timing of" - "data binding [WPF], timing of source updates" - "timing of source updates [WPF]" ms.assetid: ffb7b96a-351d-4c68-81e7-054033781c64 --- # How to: Control When the TextBox Text Updates the Source This topic describes how to use the property to control the timing of binding source updates. The topic uses the control as an example. ## Example The property has a default value of . This means if an application has a with a data-bound property, the text you type into the does not update the source until the loses focus (for instance, when you click away from the ). If you want the source to be updated as you type, set the of the binding to . In the following example, the highlighted lines of code show that the `Text` properties of both the and the are bound to the same source property. The property of the binding is set to . [!code-xaml[SimpleBinding#USTHowTo](~/samples/snippets/visualbasic/VS_Snippets_Wpf/SimpleBinding/VisualBasic/Page1.xaml?highlight=33-39,41-42)] As a result, the shows the same text (because the source changes) as the user enters text into the , as illustrated by the following screenshot of the sample: ![Screenshot that shows simple data binding.](./media/how-to-control-when-the-textbox-text-updates-the-source/data-binding-simple-binding-sample.png) If you have a dialog or a user-editable form and you want to defer source updates until the user is finished editing the fields and clicks "OK", you can set the value of your bindings to , as in the following example: [!code-xaml[UpdateSource#2](~/samples/snippets/csharp/VS_Snippets_Wpf/UpdateSource/CSharp/Window1.xaml#2)] When you set the value to , the source value only changes when the application calls the method. The following example shows how to call for `itemNameTextBox`: [!code-csharp[UpdateSource#1](~/samples/snippets/csharp/VS_Snippets_Wpf/UpdateSource/CSharp/Window1.xaml.cs#1)] [!code-vb[UpdateSource#1](~/samples/snippets/visualbasic/VS_Snippets_Wpf/UpdateSource/VisualBasic/Window1.xaml.vb#1)] > [!NOTE] > You can use the same technique for properties of other controls, but keep in mind that most other properties have a default value of . For more information, see the property page. > [!NOTE] > The property deals with source updates and therefore is only relevant for or bindings. For and bindings to work, the source object needs to provide property change notifications. You can refer to the samples cited in this topic for more information. In addition, you can look at [Implement Property Change Notification](how-to-implement-property-change-notification.md). ## See also - [How-to Topics](data-binding-how-to-topics.md)