Hello,
Welcome to our Microsoft Q&A platform!
If the ItemsSource
of your listview is like this : ObservableCollection<ItemModel> datalist = new ObservableCollection<ItemModel>();
, When you change the data of the ItemsSource
(add or remove the item of listview), the listview will refresh the UI automatically.
Finally, we have a Clear Filter button on the main page, the purpose of which is to display all the Customers again. I can't get that to work.
For this, you can make a backup of your original data for exmaple, you can create another variable datalist_copy
ObservableCollection<ItemModel> datalist_copy = new ObservableCollection<ItemModel>();
When you change(remove or add) the ItemsSource of your listview (datalist
), when you remove or add the item of the datalist
, the listview will refresh the UI automatically.
Besides, you don't need to reload your data in method OnAppearing
, you just need to add event Command for your filter
Button and Clear Filter
button on the main page. When you click the filter
Button or Clear Filter
button, you just need to change the data(remove or add) of datalist
(the ItemsSource
of your listview), then the listview will refresh the UI automatically.
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
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.