We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Select item on tap.

Thread ID:

Created:

Updated:

Platform:

Replies:

141460 Dec 12,2018 02:56 PM UTC Dec 20,2018 12:59 PM UTC Xamarin.Forms 3
loading
Tags: SfPicker
Retail Solutions
Asked On December 12, 2018 02:56 PM UTC

Hi,

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.

Example code:

            Picker.SelectionChanged += (sender, args) =>
            {
                var item = Picker.SelectedItem;
                _code = _deptList.Where(d => d.DeptDescription == item).Select(d => d.Code).First();
                _department = _deptList.Where(d => d.DeptDescription == item).Select(d => d.DeptDescription).First();

                // This should only be used when I tap on item.
                currentTable.ItemsSource = GetProductsList(_code);
                compareTable.ItemsSource = GetProductsList(_code);
                totalTable.ItemsSource = GetProductsList(_code);
                PickerButton.Text = _department;
                Picker.IsOpen = false;
            };

Paul Anderson S [Syncfusion]
Replied On December 13, 2018 11:37 AM UTC

Hi Team, 
 
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 
 
 
Please let us know if you have any other concern. 
 
Regards, 
Paul Anderson 


Retail Solutions
Replied On December 19, 2018 11:44 AM UTC

Hi,


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.



Attachment: Screenshot_20181219113926_6b115f12.zip

Dhanasekar R [Syncfusion]
Replied On December 20, 2018 12:59 PM UTC

Hi Team, 
  
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. 
  
Regards,  
Dhanasekar 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;