when I click on the button to go to the page, an exception appears " System.MissingMethodException: "It is not possible to dynamically create an instance of the type 'MuseumFinder.Views.The museum list page for administrators". Reason: The constructor without parameters is not defined."
But I do not know how to fix it so that the view displays the result of the viewmodel and at the same time the transition to the page is carried out.
private async void OnCounterClicked_1(object sender, EventArgs e)
{
await AppShell.Current.GoToAsync(nameof(MuseumListPageForAdmins));
}
using MuseumFinder.ViewModels;
namespace MuseumFinder.Views;
public partial class MuseumListPageForAdmins : ContentPage
{
private MuseumListPageViewModel _viewModel;
public MuseumListPageForAdmins(MuseumListPageViewModel viewModel)
{
_viewModel = viewModel;
this.BindingContext = viewModel;
}
protected override void OnAppearing()
{
base.OnAppearing();
_viewModel.GetMuseumListCommand.Execute(null);
}
private readonly IMuseumService _museumService;
public MuseumListPageViewModel(IMuseumService museumService)
{
_museumService = museumService;
}