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

Binding SelectedValue MVVM

Thread ID:

Created:

Updated:

Platform:

Replies:

132298 Aug 24,2017 03:18 PM UTC Aug 25,2017 08:11 AM UTC Xamarin.Forms 1
loading
Tags: SfAutoComplete
Ian Nájar
Asked On August 24, 2017 03:18 PM UTC

Hi,

I would like to know how to bind the selectedvaue to a viewmodel property. To me is me very easy in other controls, however I have some difficulties with your control because it doesn't work as I would like.

In my viewmodel, I have a property called "SelectedCustomer" which is a type "Customer" class.
The only way to update this property, is from view by creating a method in code-behind to SelectionChanged, and then assing this value directly, which clearly breaks MVVM pattern.


void txtCustomer_SelectionChanged(object sender, Syncfusion.SfAutoComplete.XForms.SelectionChangedEventArgs e)
{
     vm.SelectedCustomer = !String.IsNullOrEmpry(e.Value.ToString()) ? (Customer)e.Value : null;
}

The only way to get the entire object and not only the string of the selectedcustomer is in e.Value;
Is there any other alternative to bind with a more MVVM friendly approach?


Pavendhan Kumar [Syncfusion]
Replied On August 25, 2017 08:11 AM UTC

Hi Ian,

Thank you for using Syncfusion products.

Currently we do not have any direct property to access the selected item from AutoComplete other than SelectionChanged event. We have considered your requirement as feature request and logged a feature report for the same “Support to access a SelectedItem from AutoComplete”. The feature will be implemented and included in any of our upcoming release.

Regards,
Pavendhan K. 


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

;