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
@@ -36,7 +36,7 @@ A package that brings data-binding to your Unity project.
36
36
37
37
## :pencil: About
38
38
39
-
The **UnityMvvmToolkit**is a package that allows you to bind UI elements in your `UI Document` or `Canvas`to data sources in your app. Use the samples as a starting point for understanding how to utilize the package.
39
+
The **UnityMvvmToolkit**allows you to use data binding to establish a connection between the app UI and the data it displays. This is a simple and consistent way to achieve clean separation of business logic from UI. Use the samples as a starting point for understanding how to utilize the package.
40
40
41
41
Key features:
42
42
- Runtime data-binding
@@ -271,8 +271,8 @@ Key functionality:
271
271
- Provides a base implementation for `Canvas` based view
272
272
- Automatically searches for bindable UI elements on the `Canvas`
273
273
- Allows to override the base viewmodel instance creation
274
-
- Allows to define 'property' & 'parameter' value converters
275
-
- Allows to define custom UI elements
274
+
- Allows to define [property](#propertyvalueconvertertsourcetype-ttargettype) & [parameter](#parametervalueconverterttargettype) value converters
275
+
- Allows to provide a custom bindable elements factory
@@ -380,7 +380,7 @@ And the relative UI could then be.
380
380
381
381
The `BindableButton` binds to the `ICommand` in the viewmodel, which wraps the private `IncrementCount` method. The `BindableLabel` displays the value of the `Count` property and is updated every time the property value changes.
382
382
383
-
> **Note:** You need to define `IntToStrConverter` to convert int to string.
383
+
> **Note:** You need to define `IntToStrConverter` to convert int to string. See the [PropertyValueConverter](#propertyvalueconvertertsourcetype-ttargettype) section for more information.
384
384
385
385
### AsyncCommand & AsyncCommand\<T\>
386
386
@@ -413,7 +413,7 @@ public class ImageViewerViewModel : ViewModel
> **Note:** The `ListView` & `ScrollView` are provided for `UI Toolkit` only.
732
+
> **Note:** The `BindableListView` & `BindableScrollView` are provided for `UI Toolkit` only.
728
733
729
734
#### BindableLabel
730
735
@@ -801,7 +806,7 @@ To pass a parameter to the viewmodel, see the [ParameterValueConverter](#paramet
801
806
802
807
The `BindableListView` control is the most efficient way to create lists. Use the `binding-items-source-path` of the `BindableListView` to bind to an `ObservableCollection`.
803
808
804
-
The following example demonstrates how to bind to a list of users with `BindableListView`.
809
+
The following example demonstrates how to bind to a collection of users with `BindableListView`.
805
810
806
811
Create a main `UI Document` named `UsersView.uxml` with the following content.
807
812
@@ -941,7 +946,7 @@ public class UserItemData : ICollectionItemData
941
946
942
947
### Create custom control
943
948
944
-
Let's create a bindable image UI element.
949
+
Let's create a `BindableImage` UI element.
945
950
946
951
First of all, create a base `Image` class.
947
952
@@ -984,7 +989,7 @@ public class BindableImage : Image, IBindableUIElement
984
989
}
985
990
```
986
991
987
-
The next step is to describe the data binding logic.
992
+
The next step is to describe the data binding logic. To do that, create a `BindableImageWrapper` that inherits the `BindablePropertyElement` abstract class.
@@ -1005,6 +1010,8 @@ public class BindableImageWrapper : BindablePropertyElement
1005
1010
}
1006
1011
```
1007
1012
1013
+
The **UnityMvvmToolkit** contains two abstract classes `BindableCommandElement` and `BindablePropertyElement` that provide a methods for getting properties from the `BindingContext`.
1014
+
1008
1015
Finally, tell the elements factory what to do with the new UI element.
1009
1016
1010
1017
```csharp
@@ -1061,7 +1068,7 @@ public class ImageViewerViewModel : ViewModel
1061
1068
1062
1069
To enable [async commands](#asynccommand--asynccommandt) support, you need to add the [UniTask](https://github.com/Cysharp/UniTask) package to your project.
1063
1070
1064
-
In addition to async commands **UnityMvvmToolkit** provides extensions to make [USS transition's](https://docs.unity3d.com/Manual/UIE-Transitions.html) awaitable.
1071
+
In addition to async commands **UnityMvvmToolkit** provides extensions to make [USS transition](https://docs.unity3d.com/Manual/UIE-Transitions.html)'s awaitable.
1065
1072
1066
1073
For example, your `VisualElement` has the following transitions.
0 commit comments