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 do I implement margin at the header?

Hi!

I noticed that exists a property called "TextMargin" in Xamarin.iOS sfDataGrid.

I've implemented this, but this only apply on the records, not the header.

How do I implement header margin?

I tried the "not elegant" method of insert spaces in the header name, but the problem is that some columns are right aligned, and the component "trim" the texts in this cases.

Can you help me, please?

Thanks

7 Replies

HN Harikrishnan N Syncfusion Team September 29, 2015 11:23 AM UTC

Hi Sage,

Thank you for using Syncfusion Products.

The “TextMargin” property in GridColumn is only to set the margin for the record cells. At present, there is no support for setting the margin for the header. However you can customize the alignment of the header cells using the “HeaderTextAlignment” property based on your requirements. You can align the column to the left and try inserting spaces in header name. To avoid trimming of text in that case, you can override the HeaderCellRenderer and set the LineBreakMode for the header view to WordWrap so that the text will be continued in the next line. For your reference we have prepared a sample in which the HeaderCellRenderer is overridden and the header text is wrapped and you can download the same from the below location:

Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample1413798718 

Please let us know if you have any query.

Regards,
Harikrishnan



SA SAGE September 29, 2015 02:49 PM UTC

Hi! 

Thanks for the answer.

It's ok, but in the same example that you send, note the "Price" column.

I need that the "Price" continues to be right aligned but I need put "some spaces at the end" of the price column. For that it moves to the left, to be exactly in the same price's records aligment.

I made an image edit of what I need to column header looks like.

Can you please helpe me?

Thanks

Attachment: price_column_acaba2c1.zip


HN Harikrishnan N Syncfusion Team September 30, 2015 05:58 PM UTC

Hi Sage,

It is a default behavior in Xamarin.iOS. By default the iOS will trim the extra spaces at the end in UILabels. However as a workaround you can include a transparent period at the end of the string after the spaces. Otherwise you can insert “\t” at the end of the header text and set “TextMargin” based on that for the record cells. We are checking whether there is any other solutions. We will update you if we found any.

Please let us know if you have any query.

Regards,
Harikrishnan


SA SAGE October 1, 2015 12:30 PM UTC

Hi!

Thnaks for the answer.

With \t it works, but it is too far from the edge and I can't manipulate it. With \t is a unique predefined space.

I don't understand "include a transparent period at the end of the string after the spaces".
I'm still with this problem, but I'll wait for the answer. Please let me know if you discovery any solution, because I need to implement this in my application. 

Thank you very much


HN Harikrishnan N Syncfusion Team October 2, 2015 09:45 AM UTC

Hi Sage,

We meant to include a period at the end of the header text following the spaces. We have made a workaround to achieve your requirement by overriding the GridHeaderCellRenderer. Append some spaces to the text of the UILabel following a period and make the color of the period appended at the end as transparent; such that it will look like the text is set with some margin at the right end. We have modified the sample with this workaround and you can download the sample from the below location.

Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-943963128 

Please let us know if this helps.

Regards,
Harikrishnan



SA SAGE October 2, 2015 02:42 PM UTC

Hi.

Great idea!

Thanks, it worked.

Thank you very much


HN Harikrishnan N Syncfusion Team October 5, 2015 06:01 AM UTC

Hi Sage,

T
hanks for your update.

Please let us know if you have any query.

Regards,
Harikrishnan


Loader.
Live Chat Icon For mobile
Up arrow icon