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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the horizontal text alignment for the selected value of combo box.

Thread ID:





142075 Jan 17,2019 12:38 PM UTC Apr 20,2020 05:38 AM UTC Xamarin.Forms 5
Tags: SfComboBox
Sadhik Badarudeen
Asked On January 17, 2019 12:38 PM UTC

How to change the horizontal text alignment for the selected value of combo box?

I am using SfComboBox to lad Arabic data as well, when using flow direction the drawer appears correctly but the Watermark text and the selected text appears on the other end. How can I center align or left align the selected text and the water mark.

Please advise.

Dhanasekar R [Syncfusion]
Replied On January 22, 2019 11:37 AM UTC

Hi Sadhik, 
Greeting from Syncfusion. 
We have implemented the ComboBox by inheriting the Entry control. On setting FlowDirection to RightToLeft, the entry text will be aligned always on left corner of the control, so Watermark of the ComboBox will behaves as like entry text. We have achieved your requirement for aligning selected item center using custom renderer. Please have the code snippet, sample with screenshot below. 
 public class CustomRenderer : SfComboBoxRenderer
        protected override void OnElementChanged(ElementChangedEventArgs<SfComboBox> e)
            Control.TextField.TextAlignment = UIKit.UITextAlignment.Center;


Ghaith Abu Hakmeh
Replied On April 16, 2020 08:56 PM UTC

Can I Do horizontal text alignment for the selected value of combo box In Android and Thanks

Ramya Soundar Rajan [Syncfusion]
Replied On April 17, 2020 02:17 PM UTC

Hi Ghaith, 

Greetings from Syncfusion.

We have prepared the sample with the custom renderer to achieve your requirement in Android platform. Please find the below code snippet and sample for this,

Code Snippet:  

public class CustomRenderer : SfComboBoxRenderer
        public CustomRenderer(Context context) : base(context) 
        protected override void OnElementChanged(ElementChangedEventArgs<SfComboBox> e) 
            Control.GetAutoEditText().Gravity = GravityFlags.Center; 
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboBoxSample2132919719

Please check with the above sample and let us know if you have any concern. 
Ramya S 

Lisa Lazu
Replied On April 20, 2020 03:54 AM UTC

You were great and everyone received so much from your experience and knowledge
Absolutely amazing, thank you for sharing your knowledge with me.
Good Idea isc888

Sakthivel Palaniyappan [Syncfusion]
Replied On April 20, 2020 05:38 AM UTC

Hi Lisa,

Thanks for your valuable feedback.

Please let us know if you have any other queries.

Sakthivel P.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon