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. Image for the cookie policy date

How to set values ​​obtained from a data source?

Hi, I would like to know how I can set the values ​​that I get from a data source once the control loads.

For example, I want to edit an email and I would like to see by default the names of the people I selected when creating the email, and thus add or remove recipients in my control.

Additional I tell you that I am using MVVM

Thanks

3 Replies

HM Hemalatha Marikumar Syncfusion Team October 10, 2019 06:33 PM UTC

Hi Andrés Alberto,

Greetings from Syncfusion. 
 
We would like to let you know that your requirement “Display the item from DataSource, while control is being loaded” in SfAutoComplete has been achieved by using the SelectedItem property.  
 
Please have a below code example, 
  
Code snippet: 
 
  <autoComplete:SfAutoComplete HeightRequest="40"   
                             DataSource="{Binding EmployeeCollection}" 
                             SelectedItem="{Binding SelectedItem}" 
                             DisplayMemberPath="Name" /> 
  
We have prepared the sample based on your requirement, 
  
Sample Link: 
  
  
If we misunderstood your requirement, please update us with more details regarding your requirement and update any other video representation to know your exact scenario which will more helpful to investigate further and provide a better solution. 
 
Regards,
Hemalatha M. 
 
 



AA Andrés Alberto October 15, 2019 08:05 PM UTC

This works correctly, but how can I set more than one?


HM Hemalatha Marikumar Syncfusion Team October 16, 2019 10:05 AM UTC

Hi Andrés Alberto,

Thanks for your update.

We would like to let you know that your requirement “Display more than one items in SfAutoComplete at initially” has been achieved by using MultiSelectMode which allows us to select the more than one items.

To know more about that, please refer the below UG

https://help.syncfusion.com/xamarin/sfautocomplete/multiple-selection 

Here, we have achieved your requirement using Token type in MultiSelectionMode. And using the SelectedItem property, we can populate the desired items as selected items of AutoComplete.  Prepared sample can be downloaded from below link

Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/AutoComplete_Sample-2090213431 

Code Snippet:
 
<autoComplete:SfAutoComplete HeightRequest="40"   
                             x:Name="comboBox"  
                             MultiSelectMode="Token" 
                             DataSource="{Binding EmployeeCollection}" 
                             SelectedItem="{Binding SelectedItem}" 
                             DisplayMemberPath="Name" /> 

Please let us know if you have any concern.

Regards,
Hemalatha M. 


Loader.
Live Chat Icon For mobile
Up arrow icon