A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
926 B

using Avalonia.Controls;
using Avalonia.Interactivity;
namespace ControlCatalog.Pages
{
public partial class NavigationPageMvvmPage : UserControl
{
private readonly NavigationPageMvvmShellViewModel _viewModel;
private bool _initialized;
public NavigationPageMvvmPage()
{
InitializeComponent();
ISamplePageFactory pageFactory = new SamplePageFactory();
ISampleNavigationService navigationService = new SampleNavigationService(DemoNav, pageFactory);
_viewModel = new NavigationPageMvvmShellViewModel(navigationService);
DataContext = _viewModel;
Loaded += OnLoaded;
}
private async void OnLoaded(object? sender, RoutedEventArgs e)
{
if (_initialized)
return;
_initialized = true;
await _viewModel.InitializeAsync();
}
}
}