0
votes

I have a list with a custom stepper in it, and I have a detail page for every item in this list, I need to change the value of the custom stepper when I change it in the detail page and also when I refresh the list.

This is the list of items and the info button is to go to the item detail page

items

And here is the item detail page

item detail page

How can I change it? thanks in advance

2
Are you listing the datas from api or local database?Prasanth
Im listing it from an apimohammad anouti

2 Answers

0
votes

Your data collection should implement INotifyPropertyChanged interface and you should call OnPropertyChanged for Quantity when you change value with stepper.

0
votes

Solutions:

  1. What about refresh the list in the onAppearing of listView Page?

Every time you changed the value in the item detail page and update the latest data to the sever side. Then you go back to the listView Page, it will trigger refresh in onAppearing and then you can get the updated value from API.

  1. You can use messaging-center:

when I change it in the detail page and also when I refresh the list.

Send a Messaging(stepperChanged) when the value changed:

MessagingCenter.Send<MainPage> (this, "stepperChanged");

change the value of the custom stepper

In your listView Page, Subscribe the Message named stepperChanged:

MessagingCenter.Subscribe<MainPage> (this, "stepperChanged", (sender) => {
    // do something whenever the "stepperChanged" message is sent
    // refresh the list here
});