Repository navigation
Shell Navigation with Models #14045
|
Was this ever added? I remember long time ago there was a plan to add this in Xamarin.Forms but was moved to MAUI? - xamarin/Xamarin.Forms#6848 Is this a thing now or still not? That was my major no-go with shell. Other than that it was really simple to learn in small apps. Can't find anything btw. |
Answered by
AndreasReitberger
Mar 27, 2023
Replies: 1 comment 3 replies
|
Yes, this is possible. You can pass a object para1 = new();
Dictionary<string, object> parameters = new() { { "para1", para1 } };
await Shell.Current.GoToAsync("YOUR_URI", parameters: parameters, animate: true);In the [QueryProperty(nameof(Parameter), "para1")]
public partial class AppViewModel : BaseViewModel
{
#region QueryParameter
[ObservableProperty]
protected object parameter;
//....
}The parameter can be any class type, for this example it`s just an object. For docs, see here: https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/navigation?view=net-maui-7.0#pass-data |
3 replies
Answer selected by
ziomek64
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, this is possible. You can pass a
Dictionary<string, object>parameter now.In the
ViewModel, you can access the parameter like:The parameter can be any class type, for this example it`s just an object.
For docs, see here: https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/naviga…