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

Prevent column resizing

How do you prevent the user resizing the columns? I want all of them to be fixed.

3 Replies

JG Jai Ganesh S Syncfusion Team April 25, 2016 06:31 AM UTC

Hi Richard, 
 
You can prevent the resizing in SfDataGrid by setting the “AllowResizingColumns=Fasle” in Grid or you can prevent the resizing for particular column by setting the “AllowResizing=False” in GridColumn like below code example, 
 
Code Example: 
 
<Syncfusion:SfDataGrid x:Name="SfdataGrid"  
                               AllowEditing="True"  
                               SelectionMode="Multiple" 
                               AllowGrouping="True"  
                               AllowResizingColumns="False" 
                               ShowGroupDropArea="True" 
                               AutoGenerateColumns="False" 
                               AllowFiltering="True" 
                               AllowSorting="True"   
                                /> 
 
<Syncfusion:GridTextColumn MappingName="EmployeeName" AllowResizing="False"    /> 
 
 
 
Regards, 
Jai Ganesh S 



RI Richard May 7, 2016 10:23 AM UTC

Well that had me confused for a bit. My question relates to the GridTreeControl not the DataGrid. The properties you suggest do not appear to be available n the GridTreeControl.




JG Jai Ganesh S Syncfusion Team May 9, 2016 10:19 AM UTC

Hi Richard, 
 
Sorry for the inconvenience. The GridTreeControl not have a direct API to prevent the resizing for columns. However you can achieve this by wiring the ResizingColumns event like below, 
 
this.treeGrid.Loaded += treeGrid_Loaded; 
 
void treeGrid_Loaded(object sender, RoutedEventArgs e) 
 { 
     this.treeGrid.InternalGrid.ResizingColumns += InternalGrid_ResizingColumns; 
 } 
 
void InternalGrid_ResizingColumns(object sender, GridResizingColumnsEventArgs args) 
 { 
     args.AllowResize = false; 
 } 
 
Regards, 
Jai Ganesh S 


Loader.
Live Chat Icon For mobile
Up arrow icon