navigation: transfering object

Eduard Kaufmann 41 Reputation points
thank you for your time. Be aware:  I'm a MAUI beginner!

The final objektiv: when pressing the 'Button' in the 'MainPage' --> show the objects (images) in the 'AreaPage'.
PS: I made my test-app public: ''

some remarks, now:
- only the Button: VAR-Haute, Command="{Binding VARhCommand}" is (yet) potentially made to navigate to the 'AreaPage'
  using 'await Shell.Current.GoToAsync......'. See also AppShell etc. 
  (the other Buttons still use the MainPage as target)

when navigating to the new page (AreaPage); the page comes up BUT I never see the objects I intend to transfer.

- as said, the 'AreaPage' comes up but does NOT show/keep any content! BUT, when going back, the content shows in the 'MainPage'
- I  guess I screw something with the object / program logic!

thanks for taking the time

any help is appreciated
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
916 questions
No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 42,061 Reputation points Microsoft Vendor


    when navigating to the new page (AreaPage); the page comes up BUT I never see the objects I intend to transfer.

    Please open your AreaViewModel.cs to achieve IQueryAttributable interface, then you can get data in the ApplyQueryAttributes method by query["Hikes"]. You can refer to following code.

    public partial class AreaViewModel : BaseViewModel, IQueryAttributable
        public ObservableCollection<Hike> Hikes { get; } = new();
        Hike hike;
        bool isRefreshing;
        public void ApplyQueryAttributes(IDictionary<string, object> query)
            ObservableCollection<Hike> rawList = query["Hikes"] as ObservableCollection<Hike>;
            foreach (Hike item in rawList)

    Please remove [QueryProperty(nameof(Hike), "Hike")] as well.

    Best Regards,

    Leon Lu

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Oldest