The requested page is not available for the requested platform. You are viewing the content for Default platform.

How to: Implement Custom Sorting

  • 3 min to read

This example demonstrates how to implement custom sorting in the Grid Control. To do this, handle the GridControl.CustomColumnSort event, assign your custom sorted list to the e.Result property and set the e.Handled property to True.

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CustomSorting"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Grid="using:DevExpress.UI.Xaml.Grid"
    x:Class="CustomSorting.MainPage"
    mc:Ignorable="d">

    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <CheckBox Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Custom Sort" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" />
        <Grid:GridControl Grid.Row="1" Name="grid" AutoGenerateColumns="True" NavigationStyle="None"
                          CustomColumnSort="grid_CustomColumnSort" />
    </Grid>
</Page>