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

GridGroupingControl and ShowRowHeader

Thread ID:

Created:

Updated:

Platform:

Replies:

49400 Sep 18,2006 04:55 PM UTC Sep 21,2006 08:31 AM UTC Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 18, 2006 04:55 PM UTC

Hello,

I am implementing a class which inherits from the GridGroupingControl. I am adding a property on the inherited grid, called "StretchColumnsToFit" which stretches all visible columns in the grid model to fill the available client space. I am running into a peculiar issue with the "TableOptions.ShowRowHeader" property on the grid.

I am providing a handler for the Model.QueryColWidth event, which is the segment responsible for adjusting the column sizes to their appropriate widths. When I have the "ShowRowHeader" property set to true, the row header appears as expected, and my code in the QueryColWidth handler accounts for its presence, i.e. I avoid processing the column at index 0, so that the rowheader is not factored in to the resizing.

The problem appears when I set the "ShowRowHeader" property to false. The row header is actually rendered on the grid control, and the row header itself is being factored in for my calculations. Debugging at the QueryColWidth handler indicates that even though "ShowRowHeader" property is set to false, it is still being rendered on the grid.

The "StretchColumnsToFit" property simply sets a boolean flag on the control, which is the marker to notify the handler to actually resize the columns.

Is there any reason why the ShowRowHeader property is seemingly ignored and causing issues for my resizing efforts?

I can post the code, if that would be helpful. Please let me know.

Thanks for any help you can provide.

Administrator [Syncfusion]
Replied On September 19, 2006 09:12 AM UTC

Hi John,

Reason :

Setting the ShowRowHeader to FALSE in the GridTableOptionsStyleInfo does set the DefaultRowHeaderWidth property to ZERO. It doesn''t hide the RowHeader in a Grid.

If you want to hide the Rowheader in a Grid, you can set the Properties.RowHeaders property to FALSE. Below is a code snippet.

this.gridGroupingControl1.TableModel.Properties.RowHeaders = false;

Let me know if you are looking something different.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On September 20, 2006 07:31 PM UTC

Hi Haneef,

That definitely solves the problem. By setting the Properties.RowHeaders equal to FALSE, the QueryColWidth does not receive the row header as part of the calculations. Given that the Properties object is a property on the TableModel, am I correct in assuming that if I have a multi-level data source, I would have to iterate through each level and set the RowHeaders to false on those levels to achieve the same behavior?

I have seen one side effect of using the RowHeaders property though. With the RowHeaders set to false, and then stretching the columns to fill the remaining space, there is a gap after the last column approximately 18 - 20 pixels wide; this seems to correspond to the width of the RowHeader column.

When I am determining the amount of space that I need to stretch the columns, I query the "ClientSize.Width" property. It almost seems as if this property is taking the RowHeader into consideration and "reserving" the space that would ordinarily be taken up the RowHeader. Is the grid behaving in this manner, or am I seeing some other side effect? I''ve found that I can compensate for the gap by explicitly adding a small amount of padding when obtaining the "ClientSize.Width" property, but I am loath to hard-code something of that nature.

Do you have any thoughts or recommendations on this item?

Thanks for your assistance.

>Hi John,

Reason :

Setting the ShowRowHeader to FALSE in the GridTableOptionsStyleInfo does set the DefaultRowHeaderWidth property to ZERO. It doesn''t hide the RowHeader in a Grid.

If you want to hide the Rowheader in a Grid, you can set the Properties.RowHeaders property to FALSE. Below is a code snippet.

this.gridGroupingControl1.TableModel.Properties.RowHeaders = false;

Let me know if you are looking something different.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On September 21, 2006 08:31 AM UTC

Hi John,

Use the below code snippet to iterate all GridTableModel in a grouping grid and set the Properties.RowHeader to false.

//Form load..
iterate(this.grid.TableDescriptor);

private void iterate(GridTableDescriptor td)
{
GridTableModel model = this.gridGroupingControl1.GetTableModel(td.Name);
model.Properties.RowHeaders = false;

foreach(GridRelationDescriptor rd in td.Relations)
iterate(rd.ChildTableDescriptor);
}

Please refer the below forum thread for sizing the columns in a grid.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=39471

Here is a sample for that forum.
http://www.syncfusion.com/Support/user/uploads/Forum_39471_a469a3be.zip

Thanks,
Haneef

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

;