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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfAutoComplete custom editor inside SfDataForm

Thread ID:





143959 Apr 11,2019 06:26 PM UTC Apr 16,2019 06:08 AM UTC Xamarin.Forms 5
Tags: SfAutoComplete
Asked On April 11, 2019 06:26 PM UTC

Hi guys followed these steps to create custom editor for my SfDataForm.
When my SfDataForm is bound however the value in my business object (model) is not being set inside the entry control inside the SfDataForm. I need to set the Text of the Entry control when the data form is bound.

Subburaj Pandian Veluchamy [Syncfusion]
Replied On April 12, 2019 01:13 PM UTC

Hi Mario, 
Thank you for contacting Syncfusion support. 
We have analyzed the reported query “The custom editor value doesn’t updated on initial load when set the value in model class”, to update the value for custom editor in model class, you must override the OnUpdateValue method of your custom editor class and call this method from initializeview method to update the value to the view. 
Please refer the following code, 
public class CustomEditor : DataFormEditor<SfAutoComplete> 
        public CustomEditor(SfDataForm dataForm): base(dataForm) 
        protected override SfAutoComplete OnCreateEditorView(DataFormItem dataFormItem) 
            return new SfAutoComplete(); 
        protected override void OnInitializeView(DataFormItem dataFormItem, SfAutoComplete view) 
            base.OnInitializeView(dataFormItem, view); 
            this.OnUpdateValue(dataFormItem, view); 
        protected override void OnUpdateValue(DataFormItem dataFormItem, SfAutoComplete view) 
            var cellvalue = this.DataForm.ItemManager.GetValue(dataFormItem); 
            if (cellvalue != null && view.Text == cellvalue.ToString()) 
            view.Text = cellvalue == null ? string.Empty : cellvalue.ToString(); 
We have attached sample for your reference,
Sample link: DataForm 
Note: We have implemented this OnUpdateValue override method in our 2019 Volume 1 Release update version, kindly use this or latest update version to achieve your requirement. 
We hope that this helps. Kindly revert us if you have any concern. 
Subburaj Pandian V

Replied On April 12, 2019 07:52 PM UTC

In the AutoComplete inside the SfDataForm when the user clicks the X button. How can I capture this event?

Bharathiraja K [Syncfusion]
Replied On April 15, 2019 12:35 PM UTC

Hi Mario, 
We have checked your requirement from our side and in our current implementation, we do not have event for tracking the Close Button action in SfAutoComplete. We have logged a feature report for the same. You can find the feedback link details from below.  
Please cast your vote to make it count. We will prioritize the features every release based on the demands.  
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal.  

Replied On April 15, 2019 12:43 PM UTC

Ok so how can I tell the autocomplete value turned empty?

Bharathiraja K [Syncfusion]
Replied On April 16, 2019 06:08 AM UTC

Hi Mario, 
We have checked the workaround to achieve your requirement in SfAutoComplete control. We can get the text length using ValueChanged Event. Please find the code snippet for your reference, 
Code Snippet [C#]:  
 void Handle_ValueChanged(object sender, Syncfusion.SfAutoComplete.XForms.ValueChangedEventArgs e)
            if ((sender as SfAutoComplete).Text.Length == 0)
                DisplayAlert("Items are empty", "Select an item", "Cancel");
 Sample Link : http://www.syncfusion.com/downloads/support/directtrac/general/ze/AutoComplete_143959840354946

Please check with the sample and let us know, if you have any concern.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon