Hi,
We ran into an issue with UltraGrid (WinForms Infragistics v.18.2).
When dragging a column header to group by that column and then dragging it back to the grid for ungrouping, we get the next exception:
************** Exception Text **************System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.Win.UltraWinGrid.UltraGridBase.ColumnChooser_DragDropHelper(Point mouseLocInClient, Boolean performDrop, CurrentCursor& cursorToDisplay) at Infragistics.Win.UltraWinGrid.UltraGridBase.ColumnChooser_OnDragMove(Point mouseLocInClient, CurrentCursor& cursorToDisplay) at Infragistics.Win.UltraWinGrid.UltraGrid.DragMoveHelper(Point pointInControlCoords, Boolean isMultiSelectColumnChooser) at Infragistics.Win.UltraWinGrid.GroupByButtonUIElement.OnMouseMove(MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseMoveHelper(Object sender, MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseMove(Object sender, MouseEventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraControlBase.OnMouseMove(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseMove(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Repro steps:
private class GridData { public string Col1 { get; set; }
public int Col2 { get; set; }
public int Col3 { get; set; } }
public Form1() { InitializeComponent(); ultraGrid1.DataSource = new List<GridData>() { new GridData() { Col1 = "T1", Col2 = 10, Col3 = 20 }, new GridData() { Col1 = "T2", Col2 = 30, Col3 = 40 } }; }
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { // Store the layout and root band in member variables for easy reference. UltraGridLayout layout = e.Layout; UltraGridBand rootBand = layout.Bands[0];
// Set the RowLayoutStyle to allow groups in RowLayout mode. rootBand.RowLayoutStyle = RowLayoutStyle.GroupLayout;
// Add a couple of groups. UltraGridGroup group1 = rootBand.Groups.Add("Dummy"); UltraGridGroup group2 = rootBand.Groups.Add("Group 1");
// Assign each column to a group. rootBand.Columns["Col1"].RowLayoutColumnInfo.ParentGroup = group1; rootBand.Columns["Col2"].RowLayoutColumnInfo.ParentGroup = group2; rootBand.Columns["Col3"].RowLayoutColumnInfo.ParentGroup = group2; }
The exception only appears when the groups are expanded and we reach a dataRow while dragging the grouped column header back.
Is there a workaround to get rid of this exception?
Hello ,
Thank you for the update. So looks like issue was with the older version but not with the supported version. You may upgrade the application to latest to find the fix. You may contact to sales at sales@infragistics.com
For the structured header grouping was the way to do it . You may also explore the doc here and see of you find any other wat to layout your grid:www.infragistics.com/.../wingrid
Sorry, from my example code I left out the following line:layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;Repro steps:Step 1. Grouping by Col1 by dragging the column header to the dedicated areaStep 2. Ungroup (by dragging the group by column header back (with touching a data row))
But with version v25.1 I can no longer reproduce the exception. It works well.
Our goal was to have a structured header and the grouping functionality in the same time.
For now, we've abandoned header grouping in favor of simple grouping (until we can update).Or is there another solution to have a structured header in version 18.2?Something like this: Group1 Group2GR1_Col1 GR1_Col2 GR2_Col1 GR2_Col2
Thank you
Hello,
Thank you for contacting. I used your code and setup a sample ,I tried preproducing the issue but i am not sure what exactly you are doing , i am not able to reproduce the issue so can you please provide the clear steps to reproduce the issue.
At the sample time i setup my own sample for the UltraGrid with simple grouping , i tried grouping the 1st column by dragging it at runtime and then ungrouping it and i am not able to reproduce the issue against latest supported version V25.1.
I attached my test sample here , Forms1 has your code and Form2 has mine, can you run the sample and help reproducing the issue.
Thank you.
WindowsFormsApp7.zip