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

Resizing GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

30598 Jun 21,2005 05:16 AM UTC Jun 23,2005 11:33 AM UTC WinForms 9
loading
Tags: GridControl
Anna Srinivasan
Asked On June 21, 2005 05:16 AM UTC

Hi, Note :[ggAssetView == gridGroupingControl] Private void ggdAssetView_TableControlResizingRows(object sender, GridTableControlResizingRowsEventArgs e) { if(e.Inner.Reason == GridResizeCellsReason.DoubleClick) { this.ggdAssetView.SyncfusionGridControl.TableControl.Model.RowHeights.ResizeToFit(GridRangeInfo.Table()); e.Inner.Cancel = true; } } The Above event, i am using for resizing rows in grid grouping control. For example: Col size =20 If u enter the more char then dbl click col header it gets resized to correct col width. Then, reduce the char which present in the column then do the same thing it is not resizeing but it remains same width. Simply says if u increse the char then resize it will work, the other way around is not working. Thanks, Anna

Administrator [Syncfusion]
Replied On June 21, 2005 07:55 AM UTC

Are you trying to adjust the column width or the row height? If you want to change the column width, use .Model.ColWidths.ResizeToFit instead of .Model.RowHeights.ResizeToFit.

Anna Srinivasan
Replied On June 21, 2005 10:19 AM UTC

Hi, I have attached the example for resizing cols and rows. Q1: In that example, Resizing rows is working fine.In resizing columns once i expand the column even if i dbl click the col header i am not able to get the original col width. Q2: While pressing Ctrl+A all the record which present in the grid grouping control gets selected. In this, How do i explicity set the selection color (By default it is comming dark blue) GridGroupingControl_3994.zip

Administrator [Syncfusion]
Replied On June 21, 2005 10:47 AM UTC

1)Try this code.
private void gridGroupingControl1_TableControlResizingColumns(object sender, GridTableControlResizingColumnsEventArgs e) {
	if(e.Inner.Reason == GridResizeCellsReason.DoubleClick) 
	{
		int field = e.TableControl.Table.TableDescriptor.ColIndexToField(e.Inner.Columns.Right);
		e.TableControl.Table.TableDescriptor.Columns[field].ResetWidth();
		e.Inner.Cancel = true;
	}
}
2) Try setting this property: this.gridGroupingControl1.TableOptions.SelectionBackColor = Color.LightGoldenrodYellow;

Anna Srinivasan
Replied On June 21, 2005 12:00 PM UTC

Hi, Thanks, Color property is working fine. But problem in resizing, Once you modified the field you need to change the cursor focus to some other field then only your code will work otherwise it wont work. Solution.? Thanks, Anna

Administrator [Syncfusion]
Replied On June 21, 2005 02:13 PM UTC

You can end the edit.
private void gridGroupingControl1_TableControlResizingColumns(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlResizingColumnsEventArgs e) {
	if(e.Inner.Reason == GridResizeCellsReason.DoubleClick) 
	{
		if(e.TableControl.CurrentCell.IsEditing)
		{
			e.TableControl.Table.EndEdit();
		}
		int field = e.TableControl.Table.TableDescriptor.ColIndexToField(e.Inner.Columns.Right);
		e.TableControl.Table.TableDescriptor.Columns[field].ResetWidth();
		e.Inner.Cancel = true;
	}
}

Anna Srinivasan
Replied On June 23, 2005 08:38 AM UTC

Hi, Thanks,This code works fine. Same code i am using in my project but it is not working.(I have comment out all the other event present in that class) Q1: Is there any other property i need to set, to get that action..? Thanks, Anna

Administrator [Syncfusion]
Replied On June 23, 2005 09:30 AM UTC

Is the event not being hit? Or, is the event being hit and the code not working? Are you using nested tables?

Anna Srinivasan
Replied On June 23, 2005 10:00 AM UTC

Hi, Yes, Event being hit. I am not using nested tables. Thanks, Anna

Administrator [Syncfusion]
Replied On June 23, 2005 11:33 AM UTC

Just something to try. From code, right before you call ResetWidth, explicitly set the size of the column to some value (so the grid thinks it can be ''reset''). If that does not help, then if you can upload a sample showing the problem we can try to debug it here.

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

;