New to Telerik UI for WinFormsStart a free 30-day trial

Prevent Column Dragging Over Pinned Columns in RadGridView for WinForms

Updated on Sep 24, 2025

Environment

Product VersionProductAuthor
2024.3.924RadGridView for WinFormsNadya Todorova

Description

When working with pinned columns in RadGridView, the client may want to prevent dragging unpinned columns over or between the pinned columns. Currently, unpinned column can be moved and placed between pinned columns, effectively increasing the number of pinned columns.

Solution

To achieve the desired behavior, leverage the RadDragDropService of RadGridView, which handles the drag-and-drop operations. By handling the PreviewDragOver event, you can prevent a column from being dropped over a pinned column.

Follow these steps to implement the solution:

C#
// Access the RadDragDropService
RadDragDropService svc = this.radGridView1.GridViewElement.GetService<RadDragDropService>();

// Subscribe to the PreviewDragOver event
svc.PreviewDragOver += svc_PreviewDragOver;

// Event handler to prevent dropping over pinned columns
private void svc_PreviewDragOver(object sender, RadDragOverEventArgs e)
{
    if (e.HitTarget is GridHeaderCellElement)
    {
        GridHeaderCellElement headerCell = e.HitTarget as GridHeaderCellElement;
        if (headerCell.ColumnInfo.IsPinned)
        {
            // Prevent dropping over pinned columns
            e.CanDrop = false;
        }
    }
}

See Also