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: README.md
+62-2Lines changed: 62 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -398,8 +398,6 @@ public class UserViewModel : IBindingContext
398
398
</ui:UXML>
399
399
```
400
400
401
-
The `ItemViewModel` can be serialized and deserialized without any issues.
402
-
403
401
To achieve the same result, but with minimal boilerplate code, you can automatically create an observable backing field using the `[WithObservableBackingField]` attribute from [UnityMvvmToolkit.Generator](https://github.com/LibraStack/UnityMvvmToolkit.Generator).
404
402
405
403
```csharp
@@ -464,6 +462,68 @@ public partial class UserViewModel : IBindingContext
464
462
465
463
> **Note:** The [UnityMvvmToolkit.Generator](https://github.com/LibraStack/UnityMvvmToolkit.Generator) is available exclusively for my [patrons](https://patreon.com/DimaChebanov).
466
464
465
+
#### Serializable ViewModel
466
+
467
+
A common scenario, for instance, when working with collection items, is to create a "bindable" item that can be serialized.
The `ItemViewModel` can be serialized and deserialized without any issues.
492
+
493
+
The same result, but using the `[WithObservableBackingField]` attribute from [UnityMvvmToolkit.Generator](https://github.com/LibraStack/UnityMvvmToolkit.Generator).
> **Note:** The [UnityMvvmToolkit.Generator](https://github.com/LibraStack/UnityMvvmToolkit.Generator) is available exclusively for my [patrons](https://patreon.com/DimaChebanov).
526
+
467
527
### Command & Command\<T\>
468
528
469
529
The `Command` and `Command<T>` are `ICommand` implementations that can expose a method or delegate to the view. These types act as a way to bind commands between the viewmodel and UI elements.
0 commit comments