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

How to center align the Expander Header Text in Xamarin.Forms (SfExpander)


SfExpander text alignment is not centering on Android but it centers on UWP and IOS. The HorizontalTextAlignment is set to center as follows: 

Please see below for examples



Please see attached demo project for example on the second page of the rotator. 

Any assistance would be greatly appreciated.

Attachment: SfExpander_88dea701.rar

3 Replies

GP Gnana Priya Namasivayam Syncfusion Team November 7, 2019 10:54 AM UTC

Hi Taahir, 
We have checked the reported query from our side. We would like to inform you that the reported issue gets replicated when the label is loaded directly inside the ContentView. We directly inherited from native views and we didn't handle alignment related changes. You can overcome this issue by adding the label inside any of the containers like Grid in the following code snippet. 
<expander:SfExpander HeaderIconPosition="End" BackgroundColor="#FFFFFF" HeaderBackgroundColor="#FFFFFF" AnimationDuration="200" IsExpanded="True"> 
         <Label Text="Header Details" FontSize="16" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/> 
         <Label Text="Content Details" FontSize="16" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/> 
We hope this helps. Please let us know if you require any further assistance. 
Gnana Priya N 

TA Taahir November 7, 2019 11:10 AM UTC


Thank you very much. This does resolve the issue. 

GP Gnana Priya Namasivayam Syncfusion Team November 8, 2019 05:44 AM UTC

Hi Taahir,

Thanks for the update.

We are glad that the reported issue has been resolved. 

Gnana Priya N

Live Chat Icon For mobile
Up arrow icon