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.
Unfortunately, activation email could not send to your email. Please try again.

Prevent column resizing

Thread ID:

Created:

Updated:

Platform:

Replies:

123810 Apr 22,2016 05:46 PM May 9,2016 06:19 AM WPF 3
loading
Tags: GridTreeControl
Richard
Asked On April 22, 2016 05:46 PM

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

Jai Ganesh S [Syncfusion]
Replied On April 25, 2016 02:31 AM

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 


Richard
Replied On May 7, 2016 06:23 AM

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.



Jai Ganesh S [Syncfusion]
Replied On May 9, 2016 06:19 AM

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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;