public SimpleMvvm_iOSViewController(IntPtr handle) : base(handle) { // Create binding context this.CreateBindingContext(); // Create view model with service agent ICustomerServiceAgent serviceAgent = new MockCustomerServiceAgent(); // Assign view model to the data context DataContext = new CustomerViewModel(serviceAgent); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Initialize binding setup BindingSetup.Instance.Initlialize(ApplicationContext); // Create service agent and view model ICustomerServiceAgent serviceAgent = new MockCustomerServiceAgent(); var customerViewModel = new CustomerViewModel(serviceAgent); // Create binding context, passing view model _bindingContext = new MvxAndroidBindingContext(this, this, customerViewModel); // Create view by inflating binding on binding context var view = _bindingContext.BindingInflate(Resource.Layout.Main, null); // Set content view passing inflated view with bindings SetContentView(view); }