Hello,
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();
[ObservableProperty]
Hike hike;
[ObservableProperty]
bool isRefreshing;
public void ApplyQueryAttributes(IDictionary<string, object> query)
{
ObservableCollection<Hike> rawList = query["Hikes"] as ObservableCollection<Hike>;
foreach (Hike item in rawList)
{
Hikes.Add(item);
}
}
}
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.