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

How do I implement margin at the header?

Thread ID:

Created:

Updated:

Platform:

Replies:

120623 Sep 28,2015 10:59 AM Oct 5,2015 02:01 AM Xamarin.iOS 7
loading
Tags: SfDataGrid
SAGE
Asked On September 28, 2015 10:59 AM

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

Harikrishnan N [Syncfusion]
Replied On September 29, 2015 07:23 AM

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


SAGE
Replied On September 29, 2015 10:49 AM

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

Harikrishnan N [Syncfusion]
Replied On September 30, 2015 01:58 PM

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

SAGE
Replied On October 1, 2015 08:30 AM

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

Harikrishnan N [Syncfusion]
Replied On October 2, 2015 05:45 AM

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


SAGE
Replied On October 2, 2015 10:42 AM

Hi.

Great idea!

Thanks, it worked.

Thank you very much

Harikrishnan N [Syncfusion]
Replied On October 5, 2015 02:01 AM

Hi Sage,

T
hanks for your update.

Please let us know if you have any query.

Regards,
Harikrishnan


CONFIRMATION

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.

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

;