Calling methods in your View from your ViewModel using Action-Invokes

Executing ViewModel methods from Xamarin Forms Pages is easy, but how can Page methods be called inside ViewModels?

Example use case: Focus on an Entry

Photo by ThisisEngineering RAEng on Unsplash

Say hello to Action Invoke

ViewModel Changes

Page Changes

ViewModel.OnLoginFailed = ((obj) =>
{
PasswordEntry.Focus();
});

Developers building things, on here to share knowledge. Featured blog for PlanetXamarin.com github.com/saamerm linkedin.com/in/saamer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store