I have a XAML file with a ContentView:
<ContentView Content="{Binding RoutineView}" />
This is the representation of the ContentView in my ViewModel:
private RoutineView _routineView;
public RoutineView RoutineView {
get => _routineView;
set => SetProperty(ref _routineView, value);
}
When an event occurs, I want to replace the content with a new ContentView. This is how I update the ContentView:
MessagingCenter.Subscribe<RoutineDatabase>(this, "Update", sender => {
MainThread.InvokeOnMainThreadAsync(() => {
RoutineView = new RoutineView();
}).Wait();
});
This does work on iOS but it doesn't on Android (the ContentView disappears instead). Am I doing something wrong?