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
close icon

Text Alignment

How to get TextAlignment like column money in the image below in sfdatagrid for Xamarin.Android? it aligned correctly if i use sfdatagrid for Xamarin.Forms but not with Xamarin.Android


this is the code i tried using Xamarin.Android:
var colMoney = new GridTextColumn()
{
Width = 131,
MappingName = "Money",
HeaderText = "Money",
Format = "#,##0.00;(#,##0.00)", 
AllowSorting=true,
TextAlignment = GravityFlags.Right  // GravityFlags.End
};
and this what happen for both GravityFlags.Right and GravityFlags.End:



It will be Top and Right aligned. i want to set center(vertical) and right(horizontal) like in the Xamarin.Forms
anybody can help? Thank you in advance.

3 Replies

VP Vimal Prabhu Manohkaran Syncfusion Team July 26, 2016 06:53 AM UTC

Hi Mohamad Razif,

Thank you for contacting Syncfusion Support.

Your requirement of center aligning text in SfDataGrid is possible. In Xamarin.Android it is required to specify multiple gravity flags in order to achieve the reported behavior. Please refer the following code example to achieve your requirement of text alignment.

 
GridTextColumn orderIdColumn = new GridTextColumn(); 
orderIdColumn.TextAlignment = GravityFlags.End | GravityFlags.CenterVertical; 

Regards,
Vimal Prabhu
 



MR Mohamad Razif Hussin July 26, 2016 10:10 AM UTC

It works. Thank you very much. 


VP Vimal Prabhu Manohkaran Syncfusion Team July 26, 2016 09:13 PM UTC

Hi Muhamad,

Thanks for the update. We are happy and glad that we were able to help you.

Regards,
Vimal Prabhu

Loader.
Live Chat Icon For mobile
Up arrow icon