We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to select the entire column in SfDataGrid ?

Platform: WPF |
Control: SfDataGrid


In SfDataGrid you can select the entire column by using SfDataGrid.SelectCells method. The cell selection is enabled by setting the SfDataGrid.SelectionUnit as Cell or Any and the SfDataGrid.SelectionMode as Extended or Multiple for selecting the entire column.

You can select the range of cells by passing the starting record of selection, column and ending record of selection and column as parameter to SfDataGrid.SelectCells method. In this case, pass starting and ending record in View with the column to be selected as in the following code example.


By handling the VisualContainer.MouseLeftButtonUp event, you can click on the Header of the SfDataGrid to select a particular column by using the following code example.


In the above code example, VisualContainer.PointToCellRowColumnIndex is used to get the RowColumnIndex of selected cell.

SfDataGrid.GetRecordAtRowIndex is a helper present in the Syncfusion.UI.Xaml.Grid.Helpers. It is used to get the record corresponding to the RowIndex.

Sample link:

WPF: http://www.syncfusion.com/downloads/support/directtrac/149035/ze/WPF-96643012933260182

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
You must log in to leave a comment
nobert jurkiewicz
Jan 20, 2017
I needed to add 



this.sfdatagrid.SelectCells(firstrowdata, column, lastrowdata, column);

to make sure only the clicked column is highlighted.

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile