using Avalonia.Controls; using ReactiveUI; namespace AvaloniaApplication10.ViewModels { public class MainWindowViewModel : ViewModelBase { UserControl _us = new Page1(); public UserControl Us { get => _us; set => this.RaiseAndSetIfChanged(ref _us, value); } Page1ViewModel _page1VM = new Page1ViewModel(); public Page1ViewModel Page1VM { get => _page1VM; set => _page1VM = value; } public Page2ViewModel Page2VM { get => page2VM; set => page2VM = value; } Page2ViewModel page2VM = new Page2ViewModel(); public void ToPage2() { Us = new Page2(); } public void ToPage1() { Us = new Page1(); } } }