Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

MVVM - Performing an action in ViewModel from page OnAppearing

$
0
0

I've got a full MVVM implementation which is working nicely, for a project which communicates with BLE devices.

My problem is that I want to delay connecting to the device until the Page is appearing, and also disconnect when the user leaves the Page.

I assume I need to use the OnAppearing and OnDisappearing overrides for the Page.

However, how do I call methods in my ViewModel? Previous posts indicate I need to use MessagingCenter to message between the Page and the ViewModel. Is this still the best way?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>