Hello,
when I choose a district, and for some reason, I get back to change the city, the districts Picker is never filled with any data.
If you reselect the city, the district picker do not update, Am I right?
If so, please set ObservableCollection for your Regions property. Because ObservableCollection implement the INotifyPropertyChanged interface, when you update the ObservableCollection, picker's ItemsSource will be change at runtime.
And change your LoadRegions method like following code. when you get the new Rigons, clean it and add the new Rigons.
public ObservableCollection<Category> Regions { get; set; } = new ObservableCollection<Category>();
private async Task LoadRegions()
{
(List<Category> regionsData, string regionsResponse) = await new
CategoriesJsonService().LoadRegionsByCity(Guid.Parse(CityGuide));
if (regionsResponse != "Success!")
{
//error message
await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PushAsync(new MessageView("حدث خطأ اثناء عملية الاتصال بمزود البيانات"));
return;
}
Regions.Clear();
foreach (var item in regionsData)
{
Regions.Add(item);
}
// Regions = regionsData;
}
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.