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
Copy file name to clipboardExpand all lines: learn-pr/dot-net-maui/separate-ui-and-logic-with-data-binding/includes/3-use-data-bindings-xaml.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Let's look at a simple binding created in XAML by using the `{Binding}` markup e
30
30
31
31
The binding source is:
32
32
33
-
- An object instance of the `WeatherService` type. This is referenced through the `{StaticResource ...}` XAML extension, which points to an object in the stack layout's resource dictionary.
33
+
- An object instance of the `WeatherService` type. The instance is referenced through the `{StaticResource ...}` XAML extension, which points to an object in the stack layout's resource dictionary.
34
34
35
35
- The `Path` points to a property named `Humidity` on the `WeatherService` type.
36
36
@@ -60,7 +60,7 @@ One useful feature of binding is being able to bind to other controls. The follo
60
60
</VerticalStackLayout>
61
61
```
62
62
63
-
The `Slider.Value` property is bound to the `Label.Rotation` property, but in a different way than previously explained. This is using the binding mode `OneWayToSource`, which reverses the typical binding mechanism. Instead of the **Source** updating the **Target**, `OneWayToSource` updates the **Source** when the **Target** changes. In this example when the slider moves, it updates the rotation of the label based on the slider's value, as illustrated in the following animation:
63
+
The `Slider.Value` property is bound to the `Label.Rotation` property, but in a different way than previously explained. This property is using the binding mode `OneWayToSource`, which reverses the typical binding mechanism. Instead of the **Source** updating the **Target**, `OneWayToSource` updates the **Source** when the **Target** changes. In this example when the slider moves, it updates the rotation of the label based on the slider's value, as illustrated in the following animation:
64
64
65
65
:::image type="content" source="../media/3-use-data-bindings-xaml/rotate.gif" alt-text="An animated image of a slider control being dragged with a mouse. As the slider moves, a piece of text rotates to match the position of the slider.":::
66
66
@@ -75,7 +75,7 @@ The previous example demonstrated using a static resource as a source for a sing
@@ -96,7 +96,7 @@ Rarely do you present a single piece of data from a source, though it could happ
96
96
97
97
Setting the `Source` of the binding is optional. A binding that doesn't have `Source` set automatically searches the XAML visual tree for a `BindingContext`, which is set in the XAML or assigned to a parent element by code. Bindings are evaluated following this pattern:
98
98
99
-
01. If the binding defines a `Source`, that source is used and searching stops. The binding's `Path` is applied to the `Source` to get a value. If `Source` isn't set, the search begins for a binding source.
99
+
01. If the binding defines a `Source`, that source is used, and searching stops. The binding's `Path` is applied to the `Source` to get a value. If `Source` isn't set, the search begins for a binding source.
100
100
101
101
01. The search begins with the target object itself. If the target object's `BindingContext` isn't null, the search stops and the binding's `Path` is applied to the `BindingContext` to get a value. If the `BindingContext` is null, then the search continues.
0 commit comments