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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the position of FilterToggleButton and SortIcon in header cell of SfDataGrid?

In SfDataGrid, the AllowFiltering and AllowSorting property allows you to perform filtering and sorting operations on data. You can define the AllowFiltering and AllowSorting property either at SfDataGrid or Column level.

By default, the FilterToggleButton and SortIcon appears at the right of the HeaderText .The following screenshot illustrates the default position of the FilterToggleButton and SortIcon in GridHeaderCellControl.

Figure 1: Default position of the FilterToggleButton and SortIcon

You can change the above default position to left of the header text by customizing the Header style. The following steps help you to change the position of FilterToggleButton and SortIcon in header cell.

Step 1:

Right-click SfDataGrid in the Visual Studio or Blend Designer view and select Edit Additional Templates -> Edit HeaderStyle-> Edit a Copy.

Figure 2: Editing Header Style

Step2:

A new window opens and in that window, mention where you want to define the template and then click OK.

Figure 3: Create Style Resource window

The GridHeaderCellControl template is added in the XAML page and you can change the positon of FilterToggleButton, SortIcon and HeaderText in PART_HeaderCellBorder of the control template set as illustrated in the following code example.

XAML

The following screenshot displays the position change of SortIcon, FilterToggleButton from right to left position of the HeaderText.

Figure 4: After changed the position of FilterToggleButton and SortIcon

Refer to the following sample link for changing the position of the FilterToggleButton and SortIcon on the Header cell in WPF platform,

Sample Link:

WPF: CustomizeFilterAndSortIcon_WPF.zip

WRT: CustomizeFilterAndSortIcon_WRT.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
4052 02/16/2015 05/27/2015 WPF SfDataGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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