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

How can I get margin values in a GridDataBoundGrid?

I am using a GridDataBoundGrid. I am handling the PrepareViewStyleInfo event to add row headers to my data bound grid. I am using the ColWidths property to set the width of the column containing the row headers, which of course is column zero. How can I programmatically determine the width of the margins that Syncfusion uses for either row headers or column headers that it creates? I''d like to use this value in my algorithm for setting the width of my row headers. I can''t get this information from my grid''s Model.RowStyles indexer, because data bound grids don''t have RowStyles. I''ve tried getting the margin information from several other places, such as GridPrepareViewStyleInfoEventArgs.Style.TextMargins, and my grid''s CellRenderers["TextBox"].StyleInfo.TextMargins, but in both cases the GridMarginsInfo Left and Right properties contain the value 1. When Syncfusion puts headers in a grid, it looks to me like there is more than 1 pixel separating the text from the cell borders, so I have two questions. 1) How can I get the margin values that are normally used in the column and/or row headers of Syncfusion grids? 2) Does Syncfusion use some other value to place some empty space between header labels and their cell borders? I''m using Syncfusion version 3.0.1.6 and MS Visual Studio .NET 2003 with the 1.1 Framework on Windows XP SP2.

1 Reply

AD Administrator Syncfusion Team August 5, 2005 10:43 PM UTC

The styles of the row headers come from grid.BaseStylesMap["Row Header"].StyleInfo. Other padding of the cells contents can be also attributed to style.TextMargins values. But the raised look of a Header cell is actually explicitly drawn by the header cellrenderer.OnDraw code. So, the BorderMargins likely will not affect this. If you want to have the full use of the margins in header cells, you should try changing style.CellType to something like "Static" which will make the header cell not use the header cellRenderer which explicitly draws the raised edges on the normal header cell. After doing this, you can also set Borders, Appearances and other style setting on the grid.BaseStylesMap["Row Header"].StyleInfo and have them take effect. If you do not change teh CellType, then the header renderer will ignore these setting and do what it does to draw teh standard raised header cell.

Loader.
Live Chat Icon For mobile
Up arrow icon