You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<dl><dt>updateSourceTriggerMemberName</dt><dd>updateSourceTriggerMemberNameA named constant from the UpdateSourceTrigger enumeration, such as Explicit.</dd>
25
24
</dl>
25
+
26
26
## -property-value
27
-
One of the [UpdateSourceTrigger](updatesourcetrigger.md) values. The default is **Default**, which evaluates as a **PropertyChanged** update behavior.
27
+
28
+
One of the [UpdateSourceTrigger](updatesourcetrigger.md) values. The default is `Default`, which evaluates as a `PropertyChanged` update behavior for most dependency properties, but evaluates as `LostFocus` for the `TextBox.Text` property.
28
29
29
30
## -remarks
30
-
Your other choice for an [UpdateSourceTrigger](updatesourcetrigger.md) behavior is to set the value to be **Explicit**. When a two-way binding has its [UpdateSourceTrigger](updatesourcetrigger.md) value as **Explicit**, you must explicitly call [UpdateSource](bindingexpression_updatesource_190615267.md) on the relevant [BindingExpression](bindingexpression.md) to cause the changed target values to update the data source. Use [GetBindingExpression](../windows.ui.xaml/frameworkelement_getbindingexpression_1210399878.md) to get a [BindingExpression](bindingexpression.md) from an object where a [Binding](binding.md) to a dependency property exists and that binding is a two-way binding with `UpdateSourceTrigger="Explicit"`.
31
+
32
+
The default behavior for most dependency properties is `PropertyChanged`. However, the default behavior for the [TextBox.Text](../windows.ui.xaml.controls/textbox_text.md) property is `LostFocus`. For a [Binding](binding.md) to `TextBox.Text`, you can change the `UpdateSourceTrigger` like this:
However, it won’t have any effect on a `TextBox` in the control template of another control, such as [NumberBox](/windows/winui/api/microsoft.ui.xaml.controls.numberbox). For example, this `UpdateSourceTrigger` setting has no effect.
39
+
40
+
```xaml
41
+
<!-- This UpdateSourceTrigger setting has no effect. -->
Your other choice for an [UpdateSourceTrigger](updatesourcetrigger.md) behavior is to set the value to be `Explicit`. When a two-way binding has its [UpdateSourceTrigger](updatesourcetrigger.md) value as `Explicit`, you must explicitly call [UpdateSource](bindingexpression_updatesource_190615267.md) on the relevant [BindingExpression](bindingexpression.md) to cause the changed target values to update the data source. Use [GetBindingExpression](../windows.ui.xaml/frameworkelement_getbindingexpression_1210399878.md) to get a [BindingExpression](bindingexpression.md) from an object where a [Binding](binding.md) to a dependency property exists and that binding is a two-way binding with `UpdateSourceTrigger="Explicit"`.
31
46
32
47
You can't set the property values of a [Binding](binding.md) object after that binding has been attached to a target element and target property. If you attempt this you'll get a run-time exception.
33
48
34
49
## -examples
35
50
36
51
## -see-also
52
+
37
53
[UpdateSource](bindingexpression_updatesource_190615267.md), [Mode](binding_mode.md), [XAML data binding sample](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/XamlBind), [Data binding in depth](/windows/uwp/data-binding/data-binding-in-depth), [Dependency properties overview](/windows/uwp/xaml-platform/dependency-properties-overview), [GetBindingExpression](../windows.ui.xaml/frameworkelement_getbindingexpression_1210399878.md), [BindingOperations.SetBinding](bindingoperations_setbinding_746099660.md)
Copy file name to clipboardExpand all lines: windows.ui.xaml.data/updatesourcetrigger.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,27 +10,31 @@ public enum Windows.UI.Xaml.Data.UpdateSourceTrigger : int
10
10
# UpdateSourceTrigger
11
11
12
12
## -description
13
-
Defines constants that indicate when a binding source is updated by its binding target in two-way binding.
14
-
15
13
14
+
Defines constants that indicate when a binding source is updated by its binding target in two-way binding.
16
15
17
16
## -enum-fields
17
+
18
18
### -field Default:0
19
-
Use default behavior from the dependency property that uses the binding. In Windows Runtime, this evaluates the same as a value with **PropertyChanged**.
19
+
20
+
Use default behavior from the dependency property that uses the binding.
20
21
21
22
### -field PropertyChanged:1
23
+
22
24
The binding source is updated whenever the binding target value changes. This is detected automatically by the binding system.
23
25
24
26
### -field Explicit:2
25
-
The binding source is updated only when you call the [BindingExpression.UpdateSource](bindingexpression_updatesource_190615267.md) method.
26
27
28
+
The binding source is updated only when you call the [BindingExpression.UpdateSource](bindingexpression_updatesource_190615267.md) method. (Not supported for `x:Bind`.)
27
29
28
30
### -field LostFocus:3
31
+
29
32
The binding source is updated whenever the binding target element loses focus.
30
33
31
34
## -remarks
35
+
32
36
> [!NOTE]
33
-
> The default UpdateSourceTrigger value is **Default** rather than **PropertyChanged** for legacy reasons. Previous XAML frameworks enabled a way to register a dependency property with a value that influenced what its default binding update behavior does. That dependency property behavior isn't implemented in the Windows Runtime.
37
+
> The default UpdateSourceTrigger value is `Default` rather than `PropertyChanged` for legacy reasons. This evaluates as a `PropertyChanged`update behavior for most dependency properties, but evaluates as `LostFocus` for the `TextBox.Text` property.
0 commit comments