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: getting-started/value-vs-data-binding.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,25 +36,25 @@ Value binding has two forms:
36
36
37
37
One-way binding does *not* update the view-model if the component changes this value.
38
38
39
-
When using one-way binding, you *can* use the `<ParameterName>Changed` event - for example, you can use both `Value` and `ValueChanged`.
39
+
When using one-way binding, you *can* use the `<ParameterName>Changed` event. For example, you can use both `Value` and `ValueChanged`.
40
40
41
41
If you want to update the view-model in this scenario, you should handle the corresponding `<Parameter>Changed` event, and in the handler you will update the view-model with the new data. This allows you to apply some synchronous logic to that new value and effectively cancel the update if you don't set the new value to the view-model.
42
42
43
43
### Two-way Binding
44
44
45
45
Two-way binding *updates* the view-model field if the component changes this value.
46
46
47
-
When using two-way binding, you _cannot_ use the `<ParameterName>Changed` event - for example, if you use `@bind-Value`, adding `ValueChanged` will throw an exception from the framework - the way two-way binding works internally in Blazor is that the event is handled to populate the view-model field already, so you cannot handle it again.
47
+
When using two-way binding, you _cannot_ use the `<ParameterName>Changed` event. For example, if you use `@bind-Value`, adding `ValueChanged` will throw an exception from the framework. The way two-way binding works internally in Blazor is that the event is handled to populate the view-model field already, so you cannot handle it again.
48
48
49
49
## Data Binding
50
50
51
-
In this documentation, we will refer to Data Binding to the process of providing a component with a collection of data (models) that it will use and display.
51
+
In this documentation, we will refer to Data Binding as the process of providing a component with a collection of data (models) that it will use and display.
52
52
53
-
There is no two-way binding in this case, the flow of the data is from the parent to the child component. If data changes happen in the child component that the parent needs to be made aware of - usually a specific event is raised that the parent can handle and apply the necessary changes to its own view-model.
53
+
There is no two-way binding in this case, the flow of the data is from the parent to the child component. Sometimes the parent component needs to be aware of data changes in the child component. The usual approach is to raise a specific event that the parent can handle and apply the necessary changes to its own view-model.
54
54
55
55
Data binding includes the following steps:
56
56
57
-
* Creating a collection with the desired set of models/primitive types in the view-model. You would usually obtain it from a data service specific to the app.
57
+
* Creating a collection with the desired set of models/primitive types in the view-model. You would usually get it from a data service specific to the app.
58
58
59
59
* Pointing the `Data` parameter of the Telerik component to that collection
60
60
@@ -63,11 +63,11 @@ Data binding includes the following steps:
63
63
64
64
## Terminology in MSDN vs Telerik Documentation
65
65
66
-
In the MSDN documentation, the `@bind` or `@bind-Value` syntax is referred to as "Data Binding" because it carries a piece of data to/from the view-model to an input component (like a simple `<input />` or its form equivalent the `<InputText />`).
66
+
In the MSDN documentation, the `@bind` or `@bind-Value` syntax is referred to as "Data Binding" because it carries a piece of data to/from the view-model to an input component (like a simple `<input />` or its form equivalent - the `<InputText />`).
67
67
68
68
In the Telerik UI for Blazor documentation, the `@bind-Value` syntax is referred to as "Value Binding" because it carries field values to and from the view-model.
69
69
70
-
In the Telerik UI for Blazor documentation, we call "Data Binding" the process of providing a collection of models to a component so that this component can work with them (for example, display them - rows in a grid, appointments in a scheduler, items in a dropdown).
70
+
In the Telerik UI for Blazor documentation, we call "Data Binding" the process of providing a collection of models to a component so that this component can work with them. For example, display them - rows in a grid, appointments in a scheduler, items in a dropdown.
71
71
72
72
In the MSDN documentation, providing data to a component like that is not covered - it uses simple HTML elements and `@foreach` loops to generate `<option>` elements for dropdowns or `<tr>` elements for grids.
0 commit comments