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
close icon

How to freeze the selected column in SfDataGrid?

Hello,


Now I can freeze my first 4 columns with the FrozenColumnCount property. Is there a way to freeze from the end as I can freeze from the beginning? My Goal I want the first 4 columns and the last 2 columns to remain constant in the table.


1 Reply

VS Vijayarasan Sivanandham Syncfusion Team January 9, 2023 06:19 PM UTC

Hi Özgür,

To freeze the last two columns in an SfDataGrid, you can use the FooterColumnCount property. Simply set this property to the number of columns you want to freeze. For example, if you want to freeze the last two columns, you would set FooterColumnCount to 2. Refer to the below code snippet,

<Syncfusion:SfDataGrid HorizontalAlignment="Left"

                        UseDrawing="Default"

                        AllowEditing="True"                       

                        FrozenColumnCount="4"

                        FooterColumnCount="2"

                        AllowFiltering="True"

                        SelectionMode="Extended"

                        AutoGenerateColumns="True"                

                        ItemsSource="{Binding PacketItems}">


API Link: https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_FooterColumnCount

UG Link: https://help.syncfusion.com/wpf/datagrid/rows#freeze-panes

Find the sample in the attachment.

Regards,

Vijayarasan S


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Sample_39aee784.zip

Loader.
Live Chat Icon For mobile
Up arrow icon