Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon What are the main features of the MvvmCross.Plugin.FieldBinding plugin


What are the main features of the MvvmCross.Plugin.FieldBinding plugin


The MvvmCross.Plugin.FieldBinding plugin is a part of the Rio binding extensions for MvvmCross, designed to enhance data binding capabilities by allowing fields to be used as data sources alongside properties. Here are the main features of this plugin:

1. Field-Based Data Binding: Traditionally, MvvmCross data binding relies on properties. However, with the FieldBinding plugin, you can use public fields in your ViewModel as sources for data binding. This flexibility is particularly useful when you want to bind directly to fields without the need for properties[1][4].

2. INotifyChanged Support for Fields: The plugin supports the use of `INotifyChanged` for dynamic fields. This means that fields can notify the UI about changes, similar to how properties do with `INotifyPropertyChanged`. This is achieved through the use of classes like `INC` (Notify Changed), which can be used to create observable fields[1].

3. Compatibility and Platform Support: The FieldBinding plugin is a pure .NET Standard plugin, making it compatible across various platforms supported by MvvmCross, including Xamarin iOS, Xamarin Android, Xamarin Forms, Windows, and Mac[1][7].

4. Integration with Other Plugins: The FieldBinding plugin can be used in conjunction with other MvvmCross plugins, such as the MvvmCross.Plugin.All package, which includes all MvvmCross plugins, and MVVMCross.Plugins.Validation.ForFieldBinding, which provides validation support for field bindings[7].

5. Usage in ViewModels: In ViewModels, you can define fields using classes like `INC` and bind them directly to UI elements. For example, you can create fields like `public readonly INC Id = new NC();` and bind them to UI components using MvvmCross binding syntax[1].

6. Binding Syntax: The plugin supports various binding syntaxes, including XML-based bindings for Android and fluent bindings for platforms like iOS. For instance, you can bind a `TextView` in Android using XML like `local:MvxBind='Text FirstName'`[1][4].

Overall, the MvvmCross.Plugin.FieldBinding plugin offers a more flexible approach to data binding by allowing the use of fields, which can simplify certain scenarios and improve code readability.

Citations:
[1] https://www.mvvmcross.com/documentation/plugins/fieldbinding
[2] https://www.mvvmcross.com/documentation/advanced/customizing-using-App-and-Setup
[3] https://www.mvvmcross.com/mvvmcross-5-release/
[4] https://www.mvvmcross.com/documentation/fundamentals/data-binding
[5] https://www.mvvmcross.com/documentation/fundamentals/viewmodel-lifecycle
[6] https://github.com/MvvmCross/MvvmCross/issues/2607
[7] https://www.nuget.org/packages/MvvmCross.Plugin.FieldBinding/
[8] https://www.mvvmcross.com/documentation/fundamentals/logging-new