I have a UltraGrid the row layout style set as below.
grid.DisplayLayout.Bands[0].RowLayoutStyle = RowLayoutStyle.GroupLayout;
Usually when I want to perform an action on column resize I use the AfterColPosChanged event. However this event is not fired and testing suggests it is due to the RowLayoutStyle being set.
What event can I handle when the row layout style is set to GroupLayout?
ThanksPaul
I have now got a related problem.
The event fires exactly as described however I keep getting a null exception when trying to use the following example code in the Infragistics help.
The code works fine when I resize the column by dragging the headers but when I resize the column by dragging the column divider on a row header is null and causes an exception.
header
When I simply out put type using e.RowLayoutItem.GetType() it returns Infragistics.Win.UltraWinGrid.RowAutoSizeLayoutManagerHolder+CellLayoutItem
e.RowLayoutItem.GetType()
private void ultraGrid1_AfterRowLayoutItemResized(object sender, Infragistics.Win.UltraWinGrid.AfterRowLayoutItemResizedEventArgs e) { Debug.Write( "AfterRowLayoutItemResized: " ); if ( e.RowLayoutItem is UltraGridColumn ) { // If the RowLayoutItem is an instance of UltraGridColumn, then cells associated // with that column are being resized. UltraGridColumn column = (UltraGridColumn)e.RowLayoutItem; Debug.Write( "Cell in row-layout resized. Column = " + column.Header.Caption );
} else { // If the RowLayoutItem is an instance of HeaderBase, then column header (also // referred to as column label) is being resized. HeaderBase header = (HeaderBase)e.RowLayoutItem; Debug.Write( "Header in row-layout resized. Header = " + header.Caption ); } Debug.WriteLine( " New Size = " + e.RowLayoutItem.PreferredSize.ToString( ) );
}
I need to know which column has been resized. Any help greatly appreciated.
Hello again,
I am happy that you got it working.
Please do not hesitate to ask if something comes up.
Thanks Boris,
That did the trick nicely.
Hello Paul,
You could use the 'AfterRowLayoutItemResized' event for that matter.
If you would like to catch when a column is resized, you could use a check-up like the following:
if (e.ResizeType == RowLayoutItemResizeType.SizeChange && e.RowLayoutItem.GetType() == typeof(UltraGridColumn) || e.RowLayoutItem.GetType() == typeof(Infragistics.Win.UltraWinGrid.ColumnHeader)) { //Your code here... }
if (e.ResizeType == RowLayoutItemResizeType.SizeChange && e.RowLayoutItem.GetType() == typeof(UltraGridColumn) || e.RowLayoutItem.GetType() == typeof(Infragistics.Win.UltraWinGrid.ColumnHeader))
{
//Your code here...
Please feel free to let me know if I misunderstood you or if you have any other questions.