Autocomplete editor in Android

This example will demonstrate how to add an auto-complete editor for a property called Animal on Android.

First you have to specify that a custom editor will be used for this property.

dataForm.RegisterEditor("Animal", EditorType.Custom);

Then you have to inherit from the default DataFormRenderer and override some of its methods.

public class CustomRendererDroid : DataFormRenderer
    private readonly Java.Lang.Object[] items = new Java.Lang.Object[] { "pretty cat", "fat cat", "fluffy cat" };

    protected override NativeCore.EntityPropertyEditor GetCustomEditorForProperty(NativeViz.RadDataForm form, NativeEngine.IEntityProperty nativeProperty, IEntityProperty property)
        if (nativeProperty.Name() == "Animal")
            return new DataFormAutoCompleteEditor(form, nativeProperty);

        return base.GetCustomEditorForProperty(form, nativeProperty, property);

    protected override void UpdateEditor(NativeCore.EntityPropertyEditor editor, IEntityProperty property)
        base.UpdateEditor(editor, property);

        if (editor.Property().Name() == "Animal")
            var autoComplete = editor.EditorView as AutoCompleteTextView;
            autoComplete.Adapter = new ArrayAdapter(Forms.Context, Resource.Layout.data_form_autocomplete_item, this.items);


using NativeViz = Com.Telerik.Widget.Dataform.Visualization;
using NativeEngine = Com.Telerik.Widget.Dataform.Engine;
using NativeCore = Com.Telerik.Widget.Dataform.Visualization.Core;

You have to define the data_form_autocomplete_item resource in the Resources\layout folder of the Android project. If the folder is missing, you have to create it. Then add the the following file: data_form_autocomplete_item.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android=""

After that you will have to replace the default DataFormRenderer with the new one in MainActivity.cs:

[assembly: ExportRenderer(typeof(Telerik.XamarinForms.Input.RadDataForm), typeof(CustomRendererDroid))]


AutoComplete Editor

See Also

In this article
Not finding the help you need? Improve this article