C# Cath picker selected item=null Xamarin.forms
如果用户不想在C# Cath picker selected item=null Xamarin.forms,c#,xamarin,xamarin.forms,picker,C#,Xamarin,Xamarin.forms,Picker,如果用户不想在选择器标签的文本中选择项,我想这样:错误!还没满呢 我试过类似的东西 try { picker.Items[picker.SelectedIndex] = null; } catch (System.ArgumentNullException) { Error.IsVisible = true; Error.Text = AppR
选择器标签的文本中选择项,我想这样:错误!还没满呢
我试过类似的东西
try
{
picker.Items[picker.SelectedIndex] = null;
}
catch (System.ArgumentNullException)
{
Error.IsVisible = true;
Error.Text = AppResources.ERROR1;
}
但它不起作用!请帮帮我。谢谢大家! 如果SelectedIndex为-1,则不选择任何项目
if (picker.SelectedIndex < 0)
{
Error.IsVisible = true;
Error.Text = AppResources.ERROR1;
}
if(picker.SelectedIndex<0)
{
Error.IsVisible=true;
Error.Text=AppResources.ERROR1;
}