0
votes

I'm using Xamarin Forms picker Control, When the control shows up on Android Device, it has 2 buttons on it the "OK" and "Cancel", on IOS however i Get only the "Done" button, it causes the user to be unable to perform cancel operation to discard its new selection and forces him to scroll back to the original selection, is there is a way to have this button? or some workaround for it?

2

2 Answers

1
votes

No, and it's unfortunate because there's nothing inherent to iOS itself that prevents it. In fact many applications allow you to cancel your pick selection.

It's just one of those Xamarin quirks.

1
votes

You can use

iOSSpecific:Picker.UpdateMode="WhenFinished"

so that the picker value only gets set when the user presses the Done button - Not quite what you asked but as an alternative its not too bad.

You need this name space

xmlns:iOSSpecific="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"

and use in your picker like this

<Picker ItemsSource="{Binding Options}"
    SelectedItem="{Binding Result}"
    ItemDisplayBinding="{Binding Label}"
    iOSSpecific:Picker.UpdateMode="WhenFinished" />