We found a very strange error that occurs if someone tries to drag a grouped column and the mouse is on the X to close the group item.
After a column is grouped, you can drag it out of the group area to ungroup, or drag it to a different location to change the group hierarchy. This works fine as long as you don't happen to grab the group by the "X" in the group area. If you place the mouse pointer on the X hold the left mouse button down, moving the mouse at all throws an object reference error. The call stack is shown below.
To make the problem even more bizarre, this doesn't occur if the user manually ​groups the column. It only seems to occur if we set the grouping in code. We allow users to save their desired display settings. We save them in an XML file and reload them using the LoadLayout and SaveLayout methods. The XML that we are loading with LoadLayout is shown below.
Error call stack:
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.WinControls.UI.GridRowBehavior.ExtendSelectionUp(GridTableElement tableElement, Rectangle viewportBounds, Point location)
at Telerik.WinControls.UI.GridRowBehavior.ExtendSelectionOnMouseMove(GridTableElement tableElement, Rectangle viewportBounds, Point location)
at Telerik.WinControls.UI.GridRowBehavior.scrollTimer_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message_ m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
LoadLayout XML:
<RadGridView GroupExpandAnimationType="Fade" ReadOnly="True" NewRowEnterKeyMode="None" CausesValidation="False" BackColor="Transparent" ForeColor="ControlText" Font="Microsoft Sans Serif, 8.25pt" Cursor="Default" RightToLeft="No" TabIndex="0" ImeMode="NoControl">
<MasterTemplate MultiSelect="True" AllowRowResize="False" Caption="test caption" EnableFiltering="True" ShowGroupedColumns="True" ReadOnly="True" AutoGenerateColumns="False" AutoExpandGroups="True" ShowRowHeaderColumn="False">
<Columns>
<Telerik.WinControls.UI.GridViewTextBoxColumn FieldName="pkTask" Name="pkTask" VisibleInColumnChooser="False" IsVisible="False" AllowSort="False" AllowGroup="False" AllowResize="False" HeaderText="pkTask" />
<Telerik.WinControls.UI.GridViewImageColumn DataType="System.Byte[]" AllowFiltering="False" TextImageRelation="ImageAboveText" Width="17" FieldName="PriorityImage" Name="PriorityImage" VisibleInColumnChooser="False" IsVisible="True" IsPinned="True" PinPosition="Left" AllowSort="False" AllowResize="False" AllowHide="False" HeaderText="" />
<Telerik.WinControls.UI.GridViewImageColumn DataType="System.Byte[]" AllowFiltering="False" Width="27" FieldName="ReadImage" Name="ReadImage" VisibleInColumnChooser="False" IsVisible="True" IsPinned="True" PinPosition="Left" AllowSort="False" AllowResize="False" AllowHide="False" HeaderText="" />
<Telerik.WinControls.UI.GridViewImageColumn DataType="System.Byte[]" AllowFiltering="False" TextImageRelation="ImageAboveText" Width="27" FieldName="NoteImage" Name="NoteImage" IsVisible="True" IsPinned="True" PinPosition="Left" AllowSort="False" AllowResize="False" AllowHide="False" HeaderText="" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="77" FieldName="TaskNumber" Name="TaskNumber" IsVisible="True" AllowGroup="False" HeaderText="Task Num" />
<Telerik.WinControls.UI.GridViewTextBoxColumn FieldName="QueueName" Name="QueueName" IsVisible="False" HeaderText="Queue" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="121" FieldName="AssignedToName" Name="AssignedToName" IsVisible="False" ReadOnly="True" HeaderText="Assigned To" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="352" FieldName="TaskDescription" Name="TaskDescription" IsVisible="True" AllowGroup="False" HeaderText="Task Description" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="66" FieldName="TaskStatusDescription" Name="TaskStatusDescription" IsVisible="True" HeaderText="Status" />
<Telerik.WinControls.UI.GridViewTextBoxColumn FieldName="TaskStatusReason" Name="TaskStatusReason" IsVisible="False" HeaderText="Reason" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="114" FieldName="TaskTypeDescription" Name="TaskTypeDescription" IsVisible="True" HeaderText="Type" />
<Telerik.WinControls.UI.GridViewDateTimeColumn Format="Long" Width="126" FieldName="DueDate" Name="DueDate" IsVisible="True" HeaderText="Date Due" />
<Telerik.WinControls.UI.GridViewTextBoxColumn AllowFiltering="False" Width="77" FieldName="DueCountdown" Name="DueCountdown" IsVisible="True" AllowSort="False" AllowGroup="False" HeaderText="Due" DisableHTMLRendering="False" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="77" FieldName="PriorityDescription" Name="PriorityDescription" IsVisible="True" HeaderText="Priority" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="182" FieldName="ClientInfo" Name="ClientInfo" IsVisible="True" HeaderText="Member Info" />
<Telerik.WinControls.UI.GridViewDateTimeColumn Format="Long" Width="118" FieldName="CompleteDate" Name="CompleteDate" IsVisible="False" AllowGroup="False" HeaderText="Date Completed" />
<Telerik.WinControls.UI.GridViewDecimalColumn Width="103" FieldName="TaskCreateUser" Name="TaskCreateUser" VisibleInColumnChooser="False" IsVisible="False" HeaderText="TaskCreateUser" />
<Telerik.WinControls.UI.GridViewDecimalColumn FieldName="fkrefTaskType" Name="fkrefTaskType" VisibleInColumnChooser="False" IsVisible="False" AllowSort="False" AllowGroup="False" AllowResize="False" HeaderText="fkrefTaskType" />
<Telerik.WinControls.UI.GridViewDecimalColumn FieldName="fkrefTaskStatus" Name="fkrefTaskStatus" VisibleInColumnChooser="False" IsVisible="False" AllowSort="False" AllowGroup="False" AllowResize="False" HeaderText="fkrefTaskStatus" />
<Telerik.WinControls.UI.GridViewDecimalColumn DataType="System.Int32" FieldName="PriorityCode" Name="PriorityCode" VisibleInColumnChooser="False" IsVisible="False" AllowGroup="False" AllowResize="False" HeaderText="PriorityCode" />
<Telerik.WinControls.UI.GridViewCheckBoxColumn MinWidth="20" FieldName="GroupTask" Name="GroupTask" VisibleInColumnChooser="False" IsVisible="False" AllowSort="False" AllowGroup="False" AllowResize="False" HeaderText="GroupTask" />
<Telerik.WinControls.UI.GridViewDateTimeColumn Format="Long" FieldName="StartDate" Name="StartDate" VisibleInColumnChooser="False" IsVisible="False" HeaderText="StartDate" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="121" FieldName="StateCaseNumber" Name="StateCaseNumber" IsVisible="True" HeaderText="State Case Number" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="123" FieldName="AssignedByName" Name="AssignedByName" IsVisible="False" ReadOnly="True" HeaderText="Assigned By" />
<Telerik.WinControls.UI.GridViewCheckBoxColumn MinWidth="20" FieldName="UserRead" Name="UserRead" VisibleInColumnChooser="False" IsVisible="False" AllowSort="False" AllowGroup="False" AllowResize="False" HeaderText="UserRead" />
<Telerik.WinControls.UI.GridViewTextBoxColumn FieldName="pkTaskAssignment" Name="pkTaskAssignment" VisibleInColumnChooser="False" IsVisible="False" AllowSort="False" AllowGroup="False" AllowResize="False" HeaderText="pkTaskAssignment" />
<Telerik.WinControls.UI.GridViewTextBoxColumn FieldName="TaskSource" Name="TaskSource" VisibleInColumnChooser="False" IsVisible="False" AllowSort="False" AllowGroup="False" ReadOnly="True" AllowResize="False" HeaderText="TaskSource" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="111" FieldName="SourceModuleName" Name="SourceModuleName" IsVisible="True" ReadOnly="True" HeaderText="Source" />
<Telerik.WinControls.UI.GridViewTextBoxColumn Width="91" FieldName="TaskOriginDescription" Name="TaskOriginDescription" IsVisible="False" HeaderText="Task Origin" />
<Telerik.WinControls.UI.GridViewTextBoxColumn DataType="System.Decimal" FieldName="fkApplicationUserAssignedTo" Name="fkApplicationUserAssignedTo" VisibleInColumnChooser="False" IsVisible="False" HeaderText="fkApplicationUserAssignedTo" />
<Telerik.WinControls.UI.GridViewDateTimeColumn Format="Long" Width="160" FieldName="CreateDate" Name="CreateDate" SortOrder="Descending" IsVisible="True" AllowGroup="False" HeaderText="Date Created" />
<Telerik.WinControls.UI.GridViewTextBoxColumn FieldName="CountyCode" Name="CountyCode" VisibleInColumnChooser="False" IsVisible="False" AllowGroup="False" ReadOnly="True" HeaderText="County Code" />
<Telerik.WinControls.UI.GridViewDateTimeColumn Format="Long" FieldName="DueDateOnly" Name="DueDateOnly" VisibleInColumnChooser="False" IsVisible="False" HeaderText="Due Date" />
<Telerik.WinControls.UI.GridViewDateTimeColumn Format="Long" Width="142" FieldName="AssignmentCreateDate" Name="AssignmentCreateDate" EnableExpressionEditor="False" IsVisible="False" AllowGroup="False" HeaderText="Date Assigned" />
<Telerik.WinControls.UI.GridViewCheckBoxColumn MinWidth="20" FieldName="UserReadNote" Name="UserReadNote" EnableExpressionEditor="False" VisibleInColumnChooser="False" IsVisible="False" AllowSort="False" AllowGroup="False" AllowResize="False" HeaderText="UserReadNote" />
<Telerik.WinControls.UI.GridViewTextBoxColumn DataType="System.Int32" FieldName="TaskNoteLength" Name="TaskNoteLength" EnableExpressionEditor="False" VisibleInColumnChooser="False" IsVisible="False" AllowSort="False" AllowGroup="False" AllowResize="False" HeaderText="TaskNoteLength" />
</Columns>
<SortDescriptors>
<Telerik.WinControls.Data.SortDescriptor PropertyName="CreateDate" Direction="Descending" />
</SortDescriptors>
<GroupDescriptors>
<Telerik.WinControls.Data.GroupDescriptor>
<GroupNames>
<Telerik.WinControls.Data.SortDescriptor PropertyName="TaskTypeDescription" />
</GroupNames>
</Telerik.WinControls.Data.GroupDescriptor>
</GroupDescriptors>
<ViewDefinition xsi:type="Telerik.WinControls.UI.TableViewDefinition" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</MasterTemplate>
<ContextMenuStrip Name="cmMenu">
<Items>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+F1" Name="" Size="345, 22" Tag="Assigned" Text="Change Task(s) Status To Assigned">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+F2" Name="" Size="345, 22" Tag="InProgress" Text="Change Task(s) Status To In Progress">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+F3" Name="" Size="345, 22" Tag="Complete" Text="Complete Task(s)">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+D" Name="" Size="345, 22" Tag="Delete" Text="Delete Task(s)">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+R" Name="" Size="345, 22" Tag="MarkRead" Text="Mark Task(s) Read">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+U" Name="" Size="345, 22" Tag="MarkUnread" Text="Mark Task(s) Un-Read">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+F7" Name="" Size="345, 22" Tag="AssgnFollowUpMarkAsComplete" Text="Assign Follow Up Date (Mark as Complete)">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+F5" Name="" Size="345, 22" Tag="Reassign" Text="Reassign Task(s)">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+F4" Name="" Size="345, 22" Tag="Copy" Text="Copy Task">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+F6" Name="" Size="345, 22" Tag="ViewTaskHistory" Text="View Task History">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripSeparator Name="" Size="342, 6" Tag="None" />
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+N" Name="" Size="345, 22" Tag="NewTask" Text="Create New Task">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+L" Name="" Size="345, 22" Tag="SelectColumns" Text="Select Columns">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+A" Name="" Size="345, 22" Tag="SelectAllTasks" Text="Select All">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+F8" Name="" Size="345, 22" Tag="EraseFilter" Text="Clear Filters">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+F12" Name="" Size="345, 22" Tag="ExportTaskList" Text="Export Tasks List">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
<System.Windows.Forms.ToolStripMenuItem ShortcutKeys="Ctrl+P" Name="" Size="345, 22" Tag="PrintTaskList" Text="Print Tasks List">
<Image xsi:type="System.Drawing.Bitmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</System.Windows.Forms.ToolStripMenuItem>
</Items>
</ContextMenuStrip>
</RadGridView>