Strangely, I did not find a direct answer to the very simple question on the internet.
How do I determine currently active ViewModel
in MvvmCross
Another way if you only want to see from your ViewModel
if it's active/visible is just to have a bool field and update it on ViewAppeared
/ ViewDisappeared
:
public class MyViewModel : MvxViewModel
{
private bool _isVisible;
public override void ViewAppeared()
{
base.ViewAppeared();
_isVisible = true;
}
public override void ViewDisappeared()
{
base.ViewDisappeared();
_isVisible = false;
}
}
Most of the times this is enough and you can use _isVisible
to check that.