)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to freeze rows and coloumns in SpreadsheetControl?

Platform: WPF |
Control: SfSpreadsheet |
Published Date: October 31, 2019 |
Last Revised Date: October 31, 2019

SpreadsheetControl provides you with a feature that enables you to freeze rows or columns of the spreadsheet, while scrolling.  To apply the freeze panes, there are two ways in Spreadsheet.

By Ribbon:

Go to the Views tab and click the Freeze Pane button. Select any of the three following options:

  • FreezePanes- Freeze the row and column before the CurrentCell.
  • FreezeTopRow- Freeze top row only.
  • FreezeFirstColumn- Freeze the first column only.

By Code:

You can specify the number of FrozenRows and FrozenColumns to freeze the range of rows and columns. If you want to keep the freeze range in saved work sheet, invoke FreezePanes method of specified range.

C#

//To freeze 5 rows and 3 columns.
this.spreadSheetControl.WorkbookLoaded += SpreadSheetControl_WorkbookLoaded;
 
private void SpreadSheetControl_WorkbookLoaded(object sender, Syncfusion.UI.Xaml.Spreadsheet.Helpers.WorkbookLoadedEventArgs args)
{
    //To maintain the freeze state in saved work sheet.
    spreadSheetControl.Workbook.ActiveSheet.Range[5, 3].FreezePanes();
    //To freeze the rows and columns in the view
    var gridModel = spreadSheetControl.ActiveGrid;
    gridModel.FrozenColumns = 3;
    gridModel.FrozenRows = 5;
 
}

 

Download the sample demo from Github.

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

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
Live Chat Icon