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.

How do you extend SfAutoComplete Properly?

Thread ID:

Created:

Updated:

Platform:

Replies:

130604 May 19,2017 07:13 PM May 29,2017 12:14 AM Xamarin.Forms 5
loading
Tags: SfAutoComplete
joel linder
Asked On May 19, 2017 07:13 PM

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>

Vanaja  Annasamy [Syncfusion]
Replied On May 22, 2017 07:53 AM

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:  http://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.
 


joel linder
Replied On May 22, 2017 03:34 PM

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

Vanaja  Annasamy [Syncfusion]
Replied On May 23, 2017 08:17 AM

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: http://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.  


joel linder
Replied On May 26, 2017 07:05 AM

Thank you! i have now solved the issue,

Vanaja  Annasamy [Syncfusion]
Replied On May 29, 2017 12:14 AM

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


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.

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.

;