AvaloniaInside / Shell

Reduces the complexity of mobile/desktop application development by providing the fundamental features that most applications require
MIT License
168 stars 10 forks source link

navigate Pass data to ViewModel #11

Open zyknow opened 9 months ago

zyknow commented 9 months ago

like maui shell,when ViewModel has IQueryAttributable,that can doing this image

but in Page ArgumentAsync method also can doing likeness function

so, i don't sure in this rep to Implement IQueryAttributable function is necessary

zyknow commented 9 months ago

and i think Maui QueryProperty is very useful ,but not only can use in Page, also can use in ViewModel image

OmidID commented 9 months ago

Hello @zyknow Thanks for sharing the idea. I will take how it works and whether we can do it here or not.

gentledepp commented 2 months ago

I saw that there is a navigate overload in Navigator Task NavigateAsync(string path, object? argument, CancellationToken cancellationToken = default);

however, the argument is never passed to the target view. Instead, the OnNavigatingAsync and OnNavigateAsync are only called on the page that is navigated away from.

Am I missing something, or is this a bug/intended?

I'd be willing to work on this feature, if you approve

OmidID commented 2 months ago

Hello @gentledepp You should use the method ArgumentAsync If you use Page class then override the method otherwise if you use your own base class then implement the INavigationLifecycle and you will have the ArgumentAsync

OnNavigatingAsync allow you to override the parameters of navigating or cancel the navigation. and OnNavigateAsync when navigation is over.