Hi Guys,
I've created a ultraGrid which contains multi-level bands. I am using below setting to make sure that when I resize the on Parent columns, child columns will get resized as well.
this._mainGrid.DisplayLayout.Override.AllowColSizing=AllowColSizing.Synchronized;
This works fine with normal grid. However, if I set up RowLayout on grid or categorize columns by using column.Group, it doesn't work anymore. How can I get child column get resized as well in such situation?
Thanks,
Xin
Hi,
I think I found something on below link:
http://blogs.infragistics.com/forums/t/52488.aspx
So now I am implementing the AfterColPosChanged Event to manually set the column width. It works fine with RowLayout setting grid. However, it throws out of stack exception for normal view. Looks like in normal view, if we say column.Width = 50, it will call AfterColPosCahnged event again then even will set the column size again and again.
Is there any setting I can disable such behavior?
You can use the EventManager on the grid to disable/enable the event. So you would disable the event, set the Width on the column and then re-enable the event. It's typically a good idea to do this in a try...finally block so that the re-enabling is always hit.
private void ultraGrid1_AfterColPosChanged(object sender, AfterColPosChangedEventArgs e) { UltraGrid grid = (UltraGrid)sender; grid.EventManager.SetEnabled(GridEventIds.AfterColPosChanged, false); try { // Copy the width of the columns to the child band } finally { grid.EventManager.SetEnabled(GridEventIds.AfterColPosChanged, true); } }