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
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.
Thanks Boris,
That did the trick nicely.
I am really happy that you were able to achieve what you were looking for with the resizing. I will be glad to assist you in the future if you have any questions.
That is excellent!
Thank you very much Boris for all your help.
I think that I got it now. You could put the following code in the 'else' body:
BindingFlags bf = BindingFlags.CreateInstance; foreach (BindingFlags bfs in Enum.GetValues(typeof(BindingFlags))) bf = bf | bfs; UltraGridColumn col1 = e.RowLayoutItem.GetType().GetField("Column", bf).GetValue(e.RowLayoutItem) as UltraGridColumn;
BindingFlags bf = BindingFlags.CreateInstance;
foreach (BindingFlags bfs in Enum.GetValues(typeof(BindingFlags))) bf = bf | bfs;
UltraGridColumn col1 = e.RowLayoutItem.GetType().GetField("Column", bf).GetValue(e.RowLayoutItem) as UltraGridColumn;
'Col1.Key' will give you the key of the resized column.
Please do not hesitate to ask if something comes up.
Having tried casting the RowLayoutItem to several different types (always with an error) I still can not discover a way of finding which column has been resized.
I can not find any documentatiopn on Infragistics.Win.UltraWinGrid.RowAutoSizeLayoutManagerHolder+CellLayout and despite having a reference to Infragistics.Win.UltraWinGrid there is not publicly visible RowAutoSizeLayoutManagerHolder class.
I would really appreciate any ideas anyone has about this problem?
Many Thanks
The problem I have with this solution is I do not know how to find out which column has been resized.
Any ideas?
Many ThanksPaul