MVVMCross version - 6.3.1
The SfListView allows users work with MVVMCross Framework. Follow the below steps to work withMVVMCross Framework:
- Inherit App.cs from MvxApplication instead of your application.
- Inherit ViewModel from the MvxViewModel.
- Connect view and view model instead of binding context by registering them.
- Derive MainActivity and AppDelegate from MvxFormsAppCompatActivity and MvxFormsApplicationDelegate for initializing renderer.
public class CoreApp : MvvmCross.Core.ViewModels.MvxApplication
{
public override void Initialize()
{
CreatableTypes()
.EndingWith("Service")
.AsInterfaces()
.RegisterAsLazySingleton();
RegisterNavigationServiceAppStart<ViewModels.MvxFormsViewModel>();
}
}
public class MvxFormsViewModel : MvxViewModel
{
public MvxFormsViewModel()
{
}
}
public class MainActivity : MvxFormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
}
}
public partial class AppDelegate : MvxFormsApplicationDelegate
{
public override UIWindow Window { get; set; }
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
SfListViewRenderer.Init();
}
}
For more details, refer to this documentation.