Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1775
ArgumentOutOfRangeException when removing from xamGrid.GroupByColumns collection
posted

Hello,

We are using Infragistics 2011 vol 1

The option of xamGrid GroupBySettings.GroupByOperation is set to GroupByOperation.MergeCells.

We have the following columns collection in xamGrid:

            TextColumn col1 = new TextColumn() { Key = "Col1", HeaderText = "Number" };
            TextColumn col2 = new TextColumn() { Key = "Col2", HeaderText = "Name" };
            TextColumn col3 = new TextColumn() { Key = "Col3", HeaderText = "LastName" };
            TextColumn col4 = new TextColumn() { Key = "Col4", HeaderText = "Adress" };
            TextColumn col5 = new TextColumn() { Key = "Col5", HeaderText = "Bool" };
            TextColumn col6 = new TextColumn() { Key = "Col6", HeaderText = "Balance" };
            GroupColumn col7 = new GroupColumn() { Key = "Col7", HeaderText = "EntityData" };
            col7.Columns.Add(col1);
            col7.Columns.Add(col2);
            col7.Columns.Add(col3);
            col7.Columns.Add(col4);
            col7.Columns.Add(col5);

            xamGrid1.Columns.Add(col7);
            xamGrid1.Columns.Add(col6);

When we add column to xamGrid.GroupByColumns column using visual interface all is ok. But when we try to remove the column from that collection, we get the OutOfRangeExpection:

Имя параметра: index
   в System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   в System.ThrowHelper.ThrowArgumentOutOfRangeException()
   в System.Collections.Generic.List`1.get_Item(Int32 index)
   в System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
   в Infragistics.Controls.Grids.ColumnBaseCollection.RemoveItem(Int32 index)
   в Infragistics.Collections.CollectionBase`1.Remove(T item)
   в Infragistics.Controls.Grids.Column.SetGroupBy(Boolean groupBy)
   в Infragistics.Controls.Grids.GroupByColumnsCollection.RemoveItem(Int32 index)
   в Infragistics.Collections.CollectionBase`1.Remove(T item)
   в Infragistics.Controls.Grids.Column.set_IsGroupBy(Boolean value)
   в Infragistics.Controls.Grids.Primitives.RemoveGroupByColumnCommand.ExecuteCommand(Column col)
   в Infragistics.Controls.Grids.ColumnCommandBase.Execute(Object parameter)
   в Infragistics.Controls.CommandSource.Execute(ICommandTarget target, Boolean canExecute)
   в Infragistics.Controls.CommandSource.LookForCommandTarget(FrameworkElement parent, Boolean execute, ICommand command)
   в Infragistics.Controls.CommandSource.InvokeCommand(Boolean execute)
   в Infragistics.Controls.CommandSource.EventFired(Object sender, EventArgs e)
   в System.Windows.Controls.Primitives.ButtonBase.OnClick()
   в System.Windows.Controls.Button.OnClick()
   в System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   в System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   в MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

 

In this example we get that error only with 2 columns: col4 (Adress) and col5 (Bool).