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
close icon

How do you extend SfAutoComplete Properly?

Ive been developing a xamarin for a couple weeks now and i started using syncfusion last week. I have tried to extend SfAutoComplete to add my own behaviours but when i run the app on my android phone i get this error: E/ArrayAdapter(31373): You must supply a resource ID for a TextView. The custom control works flawlessly on uwp but it crashes on android. What am i doing wrong?

Here my CustomSfAutoComplete Code:

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace BenderResearchXamarin.Controls
{
    class CustomDataGrid : Grid
    {
        public ObservableCollection<View> DataSource
        {
            get;
            set;
        }

        public CustomDataGrid() : base()
        {
            DataSource = new ObservableCollection<View>();
            DataSource.CollectionChanged += DataSource_CollectionChanged;
        }

        private void DataSource_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            Repopulate();
        }

        public void Repopulate()
        {
            int x = 0;
            int y = 0;

            foreach(View view in DataSource)
            {
                if(x <= this.RowDefinitions.Count)
                {
                    this.Children.Add(view, x, y);
                    x++;
                }
                else
                {
                    y++;
                    x = 0;
                    this.Children.Add(view, x, y);
                }
            }
        }
    }
}

And i add it to my axml like this:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:custom="clr-namespace:BenderResearchXamarin.Controls" //my control namespace
             x:Class="BenderResearchXamarin.Pages.DataInput">

          ....
          <custom:CustomSfAutoComplete Grid.Row="0" Grid.Column="1" x:Name="acEntity"/>
          ....
</ContentPage>

5 Replies

VA Vanaja  Annasamy Syncfusion Team May 22, 2017 11:53 AM UTC

Hi Joel,

Thank you for contacting Syncfusion support.

From your given code example we have created SfAutoComplete sample based on your requirement in Xamarin.Forms and we were unable to reproduce the reported issue "crash occurs while customizing SfAutoComplete" in Android. Please download the same from below link.

Link:  https://www.syncfusion.com/downloads/support/forum/130604/ze/AutoCompleteRenderer-1624271307 

Please run the sample and check if it meets your requirement. If not please provide the following details which are given below.

1. Please let us know whether you are experiencing the issue in Xamarin.Forms. Android or Xamarin.Android.
2. Please provide the error reproducing sample.

It will help us to work in line with your requirement.

Regards,
Vanaja R.A.
 



JL joel linder May 22, 2017 07:34 PM UTC

Thank you for answering so fast. The example you gave me worked perfectly but when i tested with my own custom implementation i got the same error. Which is good because then i know its my code causing the problems.Can you spot any problems with my implementation?Thanks again.PS. Just noticed that i pasted the wrong class on my first post. Sorry.Here is my implementation: https://pastebin.com/AVUM1b4j


VA Vanaja  Annasamy Syncfusion Team May 23, 2017 12:17 PM UTC

Hi Joel,

Thank you for the update.

We have modified the sample with your given code example and we were unable to reproduce the reported issue "crash occurs while customizing SfAutoComplete" in Android. Please download the same from below link.

Link: https://www.syncfusion.com/downloads/support/forum/130604/ze/AutoCompleteSample332272297 

Please run the given sample and check whether issue reproduces at your end. If not please modify your changes in the given sample and revert the modified sample. In some cases, the code snippet will not be helpful to replicate the issue, so please provide the error reproducing sample and that will help us to proceed further on this.

Regards,
Vanaja R.A.  



JL joel linder May 26, 2017 11:05 AM UTC

Thank you! i have now solved the issue,


VA Vanaja  Annasamy Syncfusion Team May 29, 2017 04:14 AM UTC

Hi Joel, 
  
Thank you for the update. We are glad that you have achieved your requirement. 
  
Regards, 
Vanaja R.A. 


Loader.
Live Chat Icon For mobile
Up arrow icon