- Home
- Forum
- Xamarin.Forms
- How to change the horizontal text alignment for the selected value of combo box.
How to change the horizontal text alignment for the selected value of combo box.
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.
SIGN IN To post a reply.
7 Replies
DR
Dhanasekar R
Syncfusion Team
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) { base.OnElementChanged(e); Control.TextField.TextAlignment = UIKit.UITextAlignment.Center; } } |
|
|
Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboboxSample-1089478082
Regards,
Dhanasekar
GA
Ghaith Abu Hakmeh
April 16, 2020 08:56 PM UTC
Can I Do horizontal text alignment for the selected value of combo box In Android and Thanks
RS
Ramya Soundar Rajan
Syncfusion Team
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:
|
CustomRenderer.cs:
public class CustomRenderer : SfComboBoxRenderer {
public CustomRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<SfComboBox> e)
{
base.OnElementChanged(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.
Please check with the above sample and let us know if you have any concern.
Regards,
Ramya S
LL
Lisa Lazu
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
SP
Sakthivel Palaniyappan
Syncfusion Team
April 20, 2020 05:38 AM UTC
Hi Lisa,
Thanks for your valuable feedback.
Please let us know if you have any other queries.
Regards,
Sakthivel P.
Thanks for your valuable feedback.
Please let us know if you have any other queries.
Regards,
Sakthivel P.
Thanks for sharing a great article.
You are providing wonderful information, it is very useful to us.
Keep posting like this informative articles.
Thank you.
Get to know about : LSM99 แทงบอลออนไลน์
SS
Suganya Sethuraman
Syncfusion Team
July 19, 2021 11:36 AM UTC
Hi Christine,
Thanks for the update.
Please let us know if you have any other queries.
Regards,
Suganya Sethuraman.
Thanks for the update.
Please let us know if you have any other queries.
Regards,
Suganya Sethuraman.
SIGN IN To post a reply.
- 7 Replies
- 8 Participants
-
SB Sadhik Badarudeen
- Jan 17, 2019 12:38 PM UTC
- Jul 19, 2021 11:36 AM UTC