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 avoid clipping of Sort numbers when sorting more than 9 columns?

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.

Property

DataType

Description

SortStringWidth

double

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.

C#

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

 

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
3004 12/08/2014 12/08/2014 WPF GridDataControl 4.5
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.