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 to customize the input direction of custom text editor in platform renderer?

For data type string, text editor will be created, and Entry control will be loaded in SfDataForm and you can customize the data form text editor in each platform renderer by registering custom text editor to change the appearance or default style of native control. This article demonstrates the customizing the input direction of text editor in SfDataForm.

 

Please refer the more details about custom Entry renderer support in Xamarin.Forms.

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/entry

 

Please refer the below link for more details about renderer and native control customization support in Xamarin.Forms platform.

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/renderers

 

First of all, you should register the custom editor in SfDataForm as follows using DataFormEditor calss which is used to add new editor in SfDataForm. Here `Entry` will be loaded as custom editor.

 

Code example in Xamarin.Forms project.

 

You can customize the `Entry` Editor loaded in SfDataForm by using EntryRenderer class.

And EntryRenderer allows you to customize the default native rendering by using `OnElementChanged` override method which is used to renders the native controls or customized control with their own platform specific appearance.

 

On Android platform, `EntryRenderer` class instantiates an EditText control and changed its Gravity value as Right in order to change the default input flow direction in text editor of SfDataForm.

 

Code example in Xamarin.Forms.Android project.

 

 

On iOS platform, `EntryRenderer` class instantiates an UITextField control and changed its TextAlignment value as Right in order to change the default input flow direction in text editor.

 

Code example in Xamarin.Forms.iOS project.

 

 

 

Like for UWP platform, `EntryRenderer` class instantiates an TextBox control and changed its FlowDirection value as RightToLeft to change the default input flow direction in text editor.

 

Code example in Xamarin.Forms.UWP project.

 

 

Please download the sample from below link.

CustomTextEditor

 

Article ID: Published Date: Last Revised Date: Platform: Control:
9043 07/30/2018 08/01/2018 Xamarin.Forms SfDataForm
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.