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.

How to dynamically change the value of FreezeExpandColumn in the GridTreeControl?

In the GridTreeControl, by default the first column is freezable. So when you change the width of the first column greater than the width of the Grid, then first column is freezed. You cannot scroll and see the other columns as shown in the following screenshot.

Figure 1: The First column is freezed and the remaining columns are not seen

You can overcome the above problem initially as well as dynamically.

Initial Loading:

On declaring the properties in XAML/code behind for the GridTreeControl, set the FreezeExpandColumn property to false in Grid to overcome the above problem. By default the FreezeExpandColumn property is true.

XAML

 

Run Time:

During runtime, you can set the FreezeExpandColumn property to false in the ScrollColumnsChanged and SizeChanged events of the ScrollViewer when resizing the columns or size of grid.

You can wire the ScrollColumnsChanged and SizeChanged events of the ScrollViewer inside the loaded event of the GridTreeControl as shown in the following code example,

C#

 

SizeChanged Event:

When the size of Grid is changed, SizeChanged event of the ScrollViewer gets triggered. In this case, you can get the index, based on the ScrollColumns count. When the Treegrid width is lesser than the scrollcoumns width, change the FreezeExpandColumn property to false. Else you can set the FreezeExpandColumn property to true, when the Treegrid width is greater than the scrollcoumns width.

C#

 

ScrollColumns Changed event:

On resizing the columns in the GridTreeControl, the ScrollColumnChanged event gets triggered. In this case, you can get the index based on the ScrollColumns count. Set the FreezeExpandColumn property to false when the Treegrid width is lesser than the scrollcoumns width.

 C#

You can refer to the following sample link to change the FreezeExpandColumn property value in GridTreeControl,

Sample Link: DynamicallyUnFreezeExpandColumn_WPF

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework: Product Version:
4734 04/30/2015 07/10/2015 WPF GridTreeControl 4.5 12.4.0.24
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.