How can I make a function to select an item from a picker by tapping on it. As of right now, I use "Picker.SelectionChanged" to scroll through items and then I have to press OK in my footer to confirm selection. I want to remove footer and just use simple tap on item to select item and hide picker.
PAPaul Anderson S Syncfusion Team December 13, 2018 06:37 AM
Greetings from Syncfusion.
Query: “I want to remove footer and just use simple tap on item to select item and hide picker.”
We have analyzed the reported query, for removing the footer, you can use the ShowFooter property as false. Initially the Picker will display the items to 4 or 5 based on the Picker height and you can select the item by tap/scroll and this will set the items as SelectedItem triggering the SelectionChanged event. In that you can set the IsOpen API as false for closing the SfPicker.
We have prepared a sample by using a ShowFooter property. Please have the sample from the following link
Problem with that solution is that when you have 20 items in your picker, you can't scroll through all of them and select an item that you need, because SelectionChanged stops as soon as you release picker.
Another thing that I wanted to ask is: Can you change the color of the footer? I would like to at least be able to change color of the OK and Cancel buttons to match my color scheme.
DRDhanasekar R Syncfusion Team December 20, 2018 07:59 AM
Thanks for your update.
Query 1: “when you have 20 items in your picker, you can't scroll through all of them and select an item that you need”
As per the implementation of SfPicker, SelectedItem will be changed when the scrolling is completed. So this is the reason why picker is closed when the SelectionChanged is called. In order to avoid closing picker in selection changed event, you can close the picker of FooterView and set IsOpen as false in buttons in the FooterView.
Query 2: “Can you change the color of the footer”
This can be achieved by using a FooterView. We have modified the provided sample by using the FooterView for SfPicker. Please have the sample from the following link
In this sample we have used two buttons as OK and Cancel in the FooterView. In this button click event you may close the SfPicker by setting IsOpen as false and you can give the Button color based on your application color scheme.