SelectedValue return an object

Hi,

I'm using a sfTextBoxEx un UWP and I noted that when I assign a SelectedValue to my property in my model, it return an object and not a object property. Perhaps it due to absence of SelectedValuePath.

Regards

3 Replies

MK Muneesh Kumar G Syncfusion Team October 17, 2018 06:32 AM UTC

Hi Fabio, 
 
Greetings from Syncfusion. We have analyzed the reported query, you can achieve this requirement to get an object property by binding ValueMemberPath for required property and SelectedValue for ViewModel property per the below code snippet. 
 
Code snippet [C#]: 
<editors:SfTextBoxExt x:Name="textbox" HorizontalAlignment="Center"  
 
                            VerticalAlignment="Center"  
 
                            Width="400" 
 
                            SearchItemPath="Name" 
                               
                             SelectedValue="{Binding Selected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                               
                              SelectionChanged="SfTextBoxExt_SelectionChanged" 
                                                                                         
                            ValueMemberPath="Email" 
                               
                            AutoCompleteMode="Suggest" 
 
                            AutoCompleteSource="{Binding Employees}" /> 
 
Code snippet [C#]: 
public class ViewModel 
    {  
 
       private object selecteditem; 
 
        public object Selected 
        { 
            get { return selecteditem; } 
            set 
            { 
                selecteditem = value; 
            } 
        } 
 
  
Here we have bound the Email property to ValueMemberPath, you can modify this property based your application object property name. We have prepared a sample based on this, please find the sample from the following location.  
 
  
Hope it helps.  
  
Regards,  
Muneesh Kumar G. 



FA Fabio October 18, 2018 01:28 PM UTC

Hi,
Thank you very much for your help.

Regards



MK Muneesh Kumar G Syncfusion Team October 19, 2018 04:17 AM UTC

Hi Fabio, 
 
Thanks for the update. Please let us know if you need any further assistance. 
 
Regards,   
Muneesh Kumar G.  
 


Loader.
Up arrow icon