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

How to get selected item (not text) from TextBoxExt

Thread ID:

Created:

Updated:

Platform:

Replies:

114793 Dec 9,2013 05:02 PM UTC Feb 23,2015 09:54 AM UTC WinRT 3
loading
Tags: General
Stephanie Zielenski
Asked On December 9, 2013 05:02 PM UTC

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!

Vignesh V [Syncfusion]
Replied On 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

Asad Cheema
Replied On 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.

Victory Jessie Selvam D [Syncfusion]
Replied On 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:

<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


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.

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

;