Open aybarsyalcin opened 6 years ago
PickerView.ItemsSource not supports ObservableCollection
.
Thus, you should set ResultList
to new instance of List<string>
for notify changes.
Example:
buttonAdd.Clicked += (_, __) =>
{
var viewModel = this.BindingContext as PickerViewSampleViewModel;
var oldList = viewModel.ResultList; // ex: [A, B, C]
var newListInstance = oldList.Concat(new[] { "Z" }).ToList(); // make new instance!
viewModel.ResultList = newListInstance;
};
This code is works well.
Hi, This project is very well. I have used in many views. But I need the Itemsource is as List then add item programmatically. But I can't do it. Please help me.
I use Modelviewmodel.
when clicked one button. I want to adding items programmatically on pickerview. I can add item to ResultList. But Binding is not firing on Itemsource.