I have a route that is registered using the following
Routing.RegisterRoute("SchoolHome", typeof(SchoolHomePage));
I have a page with a list of schools and when I tap a School it executes this just fine from the ViewModel Command
Shell.Current.GoToAsync($"SchoolHome?schoolid={selectedSchool.Id}");
Here is my SchoolHomePage.xaml.cs
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SchoolHomePage : ContentPage
{
public SchoolHomePage()
{
InitializeComponent();
BindingContext = new SchoolHomeViewModel();
}
}
Here is a snippet of SchoolHomeViewModel.cs
[QueryProperty("School", "schoolid")]
public class SchoolHomeViewModel : BaseViewModel
{
string school;
public string School
{
get
{
return school;
}
set
{
SetProperty(ref school, Uri.UnescapeDataString(value));
}
}
So Shell doesn't map my QueryProperty to my property School and the page doesn't navigate. If I put the QueryProperty in the ContentPage's code behind and set the ViewModel's School property there, it will pass the value along but the page still doesn't navigate. It just stays on the page with the list of schools with the one I just tapped being selected.