I am trying to add a null default value to my Picker. But I get a null exception if one of the items in ItemsSource is null. Here is the Picker on my XAML: Picker
<Picker Grid.Row="0"
x:Name="Control"
IsVisible="False"
SelectedIndexChanged="selectedIndexChanged" />
Here is the error and the values on ItemsSource:
private void updateItemsSource(object oldValue, object newValue)
{
if (oldValue is INotifyCollectionChanged oldObservable)
{
oldObservable.CollectionChanged -= onCollectionChanged;
}
Control.ItemsSource = ItemsSource;
if (ItemsSource is INotifyCollectionChanged observable)
{
observable.CollectionChanged += onCollectionChanged;
}
setDefaultSelection();
}
Is there a way to make the picker accept null values? Maybe a renderer? Otherwise I will have to use an empty string as my default value. Which I don't think is the ideal for me.