Hi,
This is happening when I ungroup a column (in UI) and pin a row (in code) in AfterSortChange event.
Any ideas to avoid this? Thanks!
Message: System.ArgumentException: Row must be from the associated RowsCollection.Parameter name: row at Infragistics.Win.UltraWinGrid.FixedRowsCollection.ValidateRow(UltraGridRow row) at Infragistics.Win.UltraWinGrid.FixedRowsCollection.Insert(Int32 index, UltraGridRow row) at Infragistics.Win.UltraWinGrid.FixedRowsCollection.Add(UltraGridRow row, Boolean top) at Infragistics.Win.UltraWinGrid.UltraGridRow.set_Fixed(Boolean value)
It looks like you are setting the Fixed property on a row that no longer belongs to the colletion. This might be because the sorting is done asynchronously. If that's the case, try calling your code from a BeginInvoke rather than directly inside the event. That might cause a delay so that the rows will be valid at that point.
Hi, When I set a fixed propery on a summary row(a row which is customized) , I have got folliwng exception Message: System.ArgumentException: Row must be from the associated RowsCollection.Parameter name: row at Infragistics.Win.UltraWinGrid.FixedRowsCollection.ValidateRow(UltraGridRow row) at Infragistics.Win.UltraWinGrid.FixedRowsCollection.Insert(Int32 index, UltraGridRow row) at Infragistics.Win.UltraWinGrid.FixedRowsCollection.Add(UltraGridRow row, Boolean top) at Infragistics.Win.UltraWinGrid.UltraGridRow.set_Fixed(Boolean value) Then I tried solution specified by Mike's Suggestion from Update 2. This seems like not fixed with this solution.
Here is my piece of code. /// <summary> /// Sets the color for Summary Row /// </summary> private void HandleInitializeRow(object sender, InitializeRowEventArgs e) { if (IsSummaryRow(e.Row)) { createFixedRow(e.Row); } } private void createFixedRow(UltraGridRow summaryRow) { if (InvokeRequired) { BeginInvoke(new FixedRowDelegate(createFixedRow), summaryRow); return; } try { summaryRow.Fixed = true; } catch (Exception e) { MessageBox.Show(e.InnerException.Message); } } I am still getting this exception. I am not sure whether I am doing wrong(only thing I am doing is I am clearing the grid and adding again somerows to it which will also have a summary row).
Anyone please tell me whether this one solved with the solution or I have to do more? Thanks in Advance, Sanjeev.
Thanks Mike,
this is working fine now. Thanks for the quick response.
This is not the solution I suggested. What you are doing here is checking InvokeRequired, which will never be true unless you are using multiple threads.
My suggestion is that you use BeginInvoke to call a method which fixes the row. You don't have to check for InvokeRequired, you want to invoke whether it's required or not.
/// <summary> /// Sets the color for Summary Row /// </summary> private void HandleInitializeRow(object sender, InitializeRowEventArgs e) { if (IsSummaryRow(e.Row)) { BeginInvoke(new FixedRowDelegate(createFixedRow), e.Row); } } private void createFixedRow(UltraGridRow summaryRow) { summaryRow.Fixed = true; }