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

How to avoid clipping of Sort numbers when sorting more than 9 columns?

Platform: WPF |
Control: GridDataControl |
.NET Framework: 4.5
Tags: sorting

GridDataControl allows sorting of table data against one or more columns. When Sorting is applied, the Grid rearranges the data to match with the current sort criteria, in ascending or descending order. The number of columns that can be sorted is unlimited. GridDataControl.ShowSortNumber property enables the visibility of the sorting order of the column at the top right corner of the column HeaderCell. However, when sorting more than 9 columns, the order of the column in the HeaderCell is clipped as shown in the following screenshot.

Figure 1: Clipped Sort number

This happens because sorting more than 9 columns is a rare case, hence, the grid by default, allocates width for displaying sort number of a single digit only. However GridDataControl provides a way to avoid this clipping of sort numbers by customizing the width allocated for the sort numbers in the HeaderCell. The property SortStringWidth” in the GridDataHeaderCellControl class allows you to set custom width for displaying the sort icon and sort numbers. The default value of this property is 25. Setting values greater than 25 increases the width for displaying the sort numbers in the header cell thereby avoiding the clipping of sort numbers, when sorting more than 9 columns.






This property is used to set the width for displaying the sort icon and sort numbers in the HeaderCell.

Default ValueThe default value of this property is 25, to display the sort icon and sort numbers of one digit.

The following code example demonstrates how to enable the visibility of sorting order and set SortStringWidth for displaying sort numbers of more than one digit.


The following screenshot illustrates the output of the above code. You can see that the sort numbers of two digits are displayed, without being clipped.

Figure 2: Sort numbers in two digits displayed


2X faster development

The ultimate WPF UI toolkit to boost your development speed.
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