I am trying to implement a form that has a textbox. The textbox needs to have multi-line enabled. Using an example I have found from another thread on here I have managed to get this working on iOS but am struggling to get it to work on Android.
In the shared project I have added the following code to the form.
this.viewModel = new ViewModel();
this.BindingContext = this.viewModel ;
dataForm.RegisterEditor("MessageToSend", EditorType.Custom);
dataForm.Source = this.viewModel.Model;
Then in the Android project I have added the following code to MainActivity.cs
[assembly: ExportRenderer(typeof(RadDataForm), typeof(CustomDataFormRenderer))]
namespace Droid
{
public class CustomDataFormRenderer : DataFormRenderer
{
public CustomDataFormRenderer(Context context) : base(context)
{
}
protected override EntityPropertyEditor GetCustomEditorForProperty(RadDataForm form,
IEntityProperty nativeProperty, Telerik.XamarinForms.Input.DataForm.IEntityProperty property)
{
if (property.PropertyName == "MessageToSend")
{
return new DataFormMultilineTextEditor(form, nativeProperty);
}
return base.GetCustomEditorForProperty(form, nativeProperty, property);
}
}
}
If I place a breakpoint in the method GetCustomEditorForProperty() it never gets executed whch would seem to suggest that the custom editor is not configured correctly. But then it works perfectly on iOS, so it must be configured.