Hi, all!
I''m constructing a hierarchical grid like in the sample ''Grid.Windows\Samples\In Depth\VirtTreeGrid''. I want to autoresize the columns but I haven''t found, how.
Then I wanted to get the viewed rows in GridRangeInfoList format in order to control selections but only the Set/GetRange() method exists using Boolean[]. Do you plan to expand GridRangeInfoList with a static method that converts such a boolean array to a GridRangeInfoList?
Thx:
Gergely Varadi
AD
Administrator
Syncfusion Team
June 9, 2005 01:15 AM UTC
1) That sample has a gridControl1.QueryColWidth event handler that prevents any col width sizing, so your user cannot change the widths and grid.ColWidths.ResizeToFit does not work. If you comment out, your user can change the col widths and you can call ResizeToFit to size a specified range. If you want the ResizeToFit to work properly on your tree cell, you will have to add a CalculatePreferredCellSize override in teh cell model class, call the baseclass, and then increase the width based on the indent needs.
2) We haven''t had this request before. I will forward it to the grid architect.
AD
Administrator
Syncfusion Team
June 9, 2005 07:23 AM UTC
Then please include a
ResizeToFit(GridRangeInfoList range)
method, as hidden rows should normally not count in an automatic resize process.
AD
Administrator
Syncfusion Team
June 9, 2005 09:53 AM UTC
If you use code like
this.grid.Model.Cols.Hidden[2] = true;
to hide the columns, then grid.Model.ColWidths.ResizeToFit should not affect them.
AD
Administrator
Syncfusion Team
June 9, 2005 02:39 PM UTC
Yes, I saw this feature. Question is, if GridResizeToFitOptions.NoShrinkSize is not set and I have hidden rows, why ResizeToFit() does not shrink the column?
AD
Administrator
Syncfusion Team
June 9, 2005 05:18 PM UTC
I think this is a problem. Putting this code in a button handler, does not work unless you comment out the Hidden line.
this.gridDataBoundGrid1.Model.Rows.Hidden[3] = true;
this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit(GridRangeInfo.Table());
I have forwarded this to the grid architect to see if I am overlooking something, but this does seem to be a defect.
AD
Administrator
Syncfusion Team
June 14, 2005 12:07 PM UTC
Say row3, row4, row5 is hidden. If I doubleclick on the line between row2 and row6, these hidden lines get visible and GridModel_RowsHiding/Hidden get called.
For each line separately, however, it is capable to handle this functionality by the ''From'' and ''To'' parameters in ''GridRowColHidingEventArgs''.
It is important for me, because I must not let the user view a single row, only row groups denoting a whole subtree. (I''m still speaking about the tree logic in ''Grid.Windows\Samples\In Depth\VirtTreeGrid'')
AD
Administrator
Syncfusion Team
June 14, 2005 12:43 PM UTC
Do you want to avoid the display of hidden rows through the doubleclick? If so, you can try handling the ReisizingRows event.
private void gridControl1_ResizingRows(object sender, GridResizingRowsEventArgs e)
{
if(e.Reason == GridResizeCellsReason.DoubleClick)
{
e.Cancel = true;
}
}
AD
Administrator
Syncfusion Team
June 14, 2005 01:01 PM UTC
This support is amazing fast, thx again.