How to get selected item (not text) from TextBoxExt
Hi there,
In WinRt, I have successfully created a TextBoxExt instance that displays descriptions from a list of objects, but I can't figure out how to get the reference to the selected item (not text) when the user accepts the suggestion. In looking at the online documentation, it explains how to show/suggest an employee's name given a collection of employees that have Name and EmailAddress properties. How, then, in the code behind, would the code access the actual Employee object (assuming they need both the name and the email address to process whatever the user was doing)?
Thanks in advance for the help!
SIGN IN To post a reply.
3 Replies
VV
Vignesh V
Syncfusion Team
December 10, 2013 11:14 AM UTC
Hi Stephanie,
We have prepared a sample to address your requirement to access the Model object. In the sample we have used 'SelectedItemChanged' event and have accessed the Model object.
Please find the sample in below link,
Please let us know if you have any queries.
Regards,
Vignesh V
AC
Asad Cheema
February 21, 2015 08:19 PM UTC
i need to check this sample app for the siad solution, but unable to download the zip file. Giving access denied error.
Regards.
VJ
Victory Jessie Selvam D
Syncfusion Team
February 23, 2015 09:54 AM UTC
Hi Asad,
Thank you for using Syncfusion products.
We deeply regret for the inconvenience being caused. We have prepared a sample and tried to meet your requirement. In the sample, we have retrieved SelectedItem(Model) object from SelectedItem property and e.NewValue in SelectedItemChanged event. Please download the sample from following link,
Code snippet:
Sample:
AutoComplete_SelectedItem.zip
Please let us know whether the provided sample is upto your requirement or not.
Regards,
Jessie
Thank you for using Syncfusion products.
We deeply regret for the inconvenience being caused. We have prepared a sample and tried to meet your requirement. In the sample, we have retrieved SelectedItem(Model) object from SelectedItem property and e.NewValue in SelectedItemChanged event. Please download the sample from following link,
Code snippet:
|
<sync:SfTextBoxExt SelectedItemChanged="AutoComplete_SelectedItemChanged" AutoCompleteSource="{Binding Sources}" AutoCompleteMode="Suggest" SearchItemPath="Name" x:Name="textBoxExt"/>
<!--Convert the SelectedItem to string using IValueConverter--> <TextBlock Text="{Binding ElementName=textBoxExt,Path=SelectedItem,Converter={StaticResource ModelToStringConverter},ConverterParameter=0}"/>
//SelectedItemChanged event of SfTextBoxExt void AutoComplete_SelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue != null && e.NewValue is Model) { name.Text = (e.NewValue as Model).Name; } } |
Sample:
AutoComplete_SelectedItem.zip
Please let us know whether the provided sample is upto your requirement or not.
Regards,
Jessie
SIGN IN To post a reply.
- 3 Replies
- 4 Participants
-
SZ Stephanie Zielenski
- Dec 9, 2013 05:02 PM UTC
- Feb 23, 2015 09:54 AM UTC