Selected item template and selecting item from code

Hi Team!

Is there any way to define selected item template? Combo box contains a list of countries with flags. User selects country. Combo box displays selected country name and corresponding flag. 

Second topic. Is there any way to set selected item from code or by binding in xaml? I.e. by setting selected index or value?

Best regards

Paul.

3 Replies

PA Paul Anderson S Syncfusion Team October 5, 2018 12:36 PM UTC

Hi Pawel, 
 
Greetings from Syncfusion. 
 
Query1: Is there any way to define selected item template? 
 
We can achieve your requirement by defining the ItemTemplate API of SfComboBox control and binded to the ViewModel properties. We have created a simple sample as per your requirement which is available in the below link. 
 
 
Query2: Is there any way to set selected item from code or by binding in xaml? 
 
Yes, we can bind the selecteditem from either code behind or in Xaml code itself and in the above sample we have binded a default value to the ComboBox. Please have a look and if your requirement differs provide us some additional information on your requirement. 
 
Please let us know if you have any concern. 
 
Regards, 
Paul Anderson 



PA Pawel November 6, 2018 01:56 PM UTC

Your sample works like a charm!

Thank you very much.

Best regards!

Pawel.


PA Paul Anderson S Syncfusion Team November 7, 2018 04:24 AM UTC

Hi Pawel, 
  
Thanks for the update. We are glad that you haev achieved your requirement. Please get in touch if you required further assistance. 
  
Regards, 
Paul Anderson 


Loader.
Up arrow icon