New to Telerik UI for WinForms? Download free 30-day trial

Pinning and Unpinning Columns

Pinning single column

Columns in RadGridView can be pinned which will result in the pinned columns being anchored to the left or right side of the grid. To pin a particular column, set its IsPinned property of the Columns collection item to True (False if you want to unpin it). This will pin the column to the left side of RadGridView. In order to change the position where the column should be pinned you have to use the PinPosition property of the particular column and choose a value from the provided enumeration. The code block below shows pinning the third column (called "FirstName") in the RadGridView:

Pinning a single columns

radGridView1.Columns[2].IsPinned = true;
radGridView1.Columns["FirstName"].IsPinned = true;

Me.RadGridView1.Columns(2).IsPinned = True
'or you can use
Me.RadGridView1.Columns("FirstName").IsPinned = True

Figure 1: The left-most column is pinned.

gridview-columns-pinning-and-unpinning-columns 001

Pinning multiple columns

Multiple column pinning is also possible. Simply set either the IsPinned property or the PinPosition property for all columns that you want to pin:

Pinning multiple columns

radGridView1.Columns["Photo"].PinPosition = Telerik.WinControls.UI.PinnedColumnPosition.Left;
radGridView1.Columns["FirstName"].PinPosition = Telerik.WinControls.UI.PinnedColumnPosition.Left;
radGridView1.Columns["LastName"].PinPosition = Telerik.WinControls.UI.PinnedColumnPosition.Left;

Me.RadGridView1.Columns("Photo").PinPosition = Telerik.WinControls.UI.PinnedColumnPosition.Left
Me.RadGridView1.Columns("FirstName").PinPosition = Telerik.WinControls.UI.PinnedColumnPosition.Left
Me.RadGridView1.Columns("LastName").PinPosition = Telerik.WinControls.UI.PinnedColumnPosition.Left

Figure 2: More than one column can be pinned as well.

gridview-columns-pinning-and-unpinning-columns 002

All pinned columns appear in the selected pinned section ordered by their original column index in the Columns collection. After pinning multiple columns you can drag each of them to the desired position in the pin section.

Figure 3: Reordering pinned columns.

gridview-columns-pinning-and-unpinning-columns 003

gridview-columns-pinning-and-unpinning-columns 004

See Also

In this article