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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Type od selecteditems

Thread ID:

Created:

Updated:

Platform:

Replies:

148557 Oct 24,2019 03:30 PM UTC Oct 30,2019 12:13 PM UTC Xamarin.Forms 6
loading
Tags: SfComboBox
Alberto
Asked On October 24, 2019 03:30 PM UTC

Hi

wihich kind of type should  i pass to the SelectedItem property?

Is "List<string>" the correct type?

I receive the exception that the object does not implement IConvertible

Then i would like use on that property a foreach to use value changed form the user

Best regards
Alberto C.



Hemalatha Marikumar [Syncfusion]
Replied On October 25, 2019 06:48 AM UTC

Hi Alberto,

Greetings from Syncfusion. 
 
Query: Which kind of type should I pass to the SelectedItem property? 
 
We would like to let you know that Type of SelectedItem property is object. Hence it holds a single item for single selection (MultiSelection Mode – None) and collection of items for multi selection (MultiSelectiion Mode – either Token or Delimiter). 
 
You can retrieve the SelectedItem from ValueChanged event also. Please download the prepared sample in below 
Query: Is "List<string>" the correct type?  
 
As mentioned above, it will be correct type of assigning to the SelectedItem with MultiSelectionMode of either in Token or Delimiter.

UG Linkhttps://help.syncfusion.com/xamarin/sfcombobox/retrieving-selected-values?cs-save-lang=1&cs-lang=csharp#selecteditem

Please check with the above sample and let us know if you have any concerns.

 
Regards, 
Hemalatha M. 


Alberto
Replied On October 25, 2019 09:27 AM UTC

I have tried with an observable collection but  when i arrive on this line of code

  EmailTo = new ObservableCollection<object>();

the application stay in pause , the screen stays frized

This is the piece of code in the xaml

 
                    <sfComboBox:SfComboBox DataSource="{Binding ListEmailTo}"
                                           SelectedItem="{Binding EmailTo}"
                                             MultiSelectMode="Token" TokensWrapMode="Wrap"             
                                               ClearButtonColor="{StaticResource Primary}"
                                               TextColor="{StaticResource PrimaryText}"
                                               DropDownTextColor="{StaticResource PrimaryText}"
                                               DropDownBorderColor="{StaticResource Primary}"                                               
                                               IsSelectedItemsVisibleInDropDown ="False">
                        <sfComboBox:SfComboBox.TokenSettings>
                            <sfComboBox:TokenSettings BackgroundColor="{StaticResource Primary}" TextColor="White"                                                                                                                    
                                                          IsCloseButtonVisible="true" 
                                                          DeleteButtonColor="{StaticResource PrimaryDark}">
                            </sfComboBox:TokenSettings>
                        </sfComboBox:SfComboBox.TokenSettings>
                    </sfComboBox:SfComboBox>


in the code properties are set in this way 

private ObservableCollection<object> _EmailTo;

        public ObservableCollection<object> EmailTo
        {
            get { return _EmailTo; }
            set { SetProperty(ref _EmailTo, value); }
        }

        private ObservableCollection<object> _ListEmailTo;

        public ObservableCollection<object> ListEmailTo
        {
            get { return _ListEmailTo; }
            set { SetProperty(ref _ListEmailTo, value); }
        }

and the piece of code when i set the variables is this

foreach (var item in invioEmailToInfo.Item1.ToList())
            {
                ListEmailTo.Add(item.Email);
            }
            
            EmailTo = new ObservableCollection<object>();

            foreach (var item in invioEmailToInfo.Item2.Split(Convert.ToChar(",")))
            {
                EmailTo.Add(item);
            }

Xamarin version 4.2.0.910310
Syncfusion.Xamarin.SfComboBox 17.3.0.19

Best Regards
Alberto C.


Hemalatha Marikumar [Syncfusion]
Replied On October 28, 2019 08:55 AM UTC

Hi Alberto,

Thanks for the update.

We have prepared the sample based on your provided code examples. Unfortunately, we were unable to reproduce the same. Please find the tested sample in below, 
 
Sample Link
https://www.syncfusion.com/downloads/support/directtrac/general/ze/CO8E99~1-938106393

If the issue mentioned differs from the above please modify the provided sample with the issue reproducing sample and also the platform details and please confirm whether the ComboBox is placed inside the SfTextInputLayout which will be helpful for us to analyze further and provide an appropriate solution. 
 
Regards, 
Hemalatha M. 


Alberto
Replied On October 28, 2019 11:03 AM UTC

Hi,

i have tested more with this control and i have noticed that, if in the constructor i set the collection i don't have any problem to see the list otherwise iif i am in a separate thread the item source is  not set correctly.


Usually after the constructor we start a parallel thread in order to load collection

await (page.BindingContext as ViewModelBase).InitializeAsync(parameter);         

With other component's we have not found any issue.

Best regards
Alberto C.


Hemalatha Marikumar [Syncfusion]
Replied On October 30, 2019 11:51 AM UTC

Hi Alberto,

Thanks for the update.
 

We have checked your requirement “Load the DataSource and SelectedItems with Async” in SfComboBox. We have prepared the sample based on your requirement.
 
  
Sample Link: 
  
Video Link: 
  
If your requirement is different from above, please let us share more details with modified sample which will more helpful to check the reported issue and provide a better solution. 
 
Regards, 
Hemalatha M. 


Hemalatha Marikumar [Syncfusion]
Replied On October 30, 2019 12:13 PM UTC

Hi Alberto,

Thanks for the update.
 

We have checked your requirement “Load the DataSource and SelectedItems with Async” in SfComboBox. We have prepared the sample based on your requirement.
 
  
Sample Link: 
  
Video Link: 
  
If your requirement is different from above, please let us share more details with modified sample which will more helpful to check the reported issue and provide a better solution. 
 
Regards, 
Hemalatha M. 


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

Live Chat Icon For mobile
Live Chat Icon