# kanban-sorting

> SfKanban with custom card sorting, priority-based ordering, and dynamic sort direction toggling.

**Framework:** wpf  **Component:** Kanban  **Variant:** sorting

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/wpf/kanban-sorting.json
```

**Install Package(s)**

```bash
dotnet add package Syncfusion.SfKanban.WPF
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/kanban-sorting/Kanban.xaml

```xaml
<UserControl x:Class="syncfusion.kanbandemos.wpf.Sorting.Kanban"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:kanban="clr-namespace:Syncfusion.UI.Xaml.Kanban;assembly=Syncfusion.SfKanban.WPF"
        xmlns:local="clr-namespace:syncfusion.kanbandemos.wpf" Unloaded="OnSampleUnloaded">

    <UserControl.DataContext>
        <local:SortingViewModel />
    </UserControl.DataContext>

    <UserControl.Resources>
        <local:IndicatorColorConverter x:Key="IndicatorColorConverter"/>

        <Style x:Key="TagBorderStyle" TargetType="Border">
            <Setter Property="Background" Value="#33FFA500"/>
            <Setter Property="CornerRadius" Value="4"/>
            <Setter Property="Padding" Value="6,2"/>
            <Setter Property="Margin" Value="0,0,4,0"/>
        </Style>

        <DataTemplate x:Key="ColumnHeaderTemplate">
            <Border Width="244" CornerRadius="12" Background="#F5F5F5" Padding="8">
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                    <TextBlock Text="{Binding Header}" FontWeight="Bold" FontSize="13"/>
                    <TextBlock Text=" - " FontWeight="Bold" FontSize="13"/>
                    <TextBlock Text="{Binding CardCount}" FontWeight="Bold" FontSize="13"/>
                    <TextBlock Text=" Items" FontWeight="Bold" FontSize="13"/>
                </StackPanel>
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="ToDoCardTemplate">
            <Border CornerRadius="12" Background="#33856EC2" Padding="8" Margin="2">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2">
                        <Path Data="M8,0 A8,8 0 1 1 7.99,0 Z" Fill="{Binding Priority, Converter={StaticResource IndicatorColorConverter}}" Width="10" Height="10" Stretch="Uniform"/>
                        <TextBlock Text="{Binding Priority}" Foreground="{Binding Priority, Converter={StaticResource IndicatorColorConverter}}" FontSize="10" VerticalAlignment="Center" Margin="4,0,0,0"/>
                        <TextBlock Text="Rank #" FontSize="10" VerticalAlignment="Center" Margin="10,0,0,0"/>
                        <TextBlock Text="{Binding Index}" FontSize="10" VerticalAlignment="Center" />
                    </StackPanel>
                    <TextBlock Grid.Row="1" Text="{Binding Title}" FontWeight="Bold" FontSize="12" TextWrapping="Wrap" Margin="0,4,0,0"/>
                    <TextBlock Grid.Row="2" Text="{Binding Description}" FontSize="10" TextWrapping="Wrap" Margin="0,4,0,0"/>
                    <ItemsControl Grid.Row="3" ItemsSource="{Binding Tags}" Margin="0,6,0,0">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border Style="{StaticResource TagBorderStyle}">
                                    <TextBlock Text="{Binding}" FontSize="10"/>
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ProgressBar Grid.Row="4" Value="{Binding Progress}" Maximum="100" Height="2" Margin="0,8,0,0"/>
                </Grid>
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="InProgressCardTemplate">
            <Border CornerRadius="12" Background="#26B06A1F" Padding="8" Margin="2">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2">
                        <Path Data="M8,0 A8,8 0 1 1 7.99,0 Z" Fill="{Binding Priority, Converter={StaticResource IndicatorColorConverter}}" Width="10" Height="10" Stretch="Uniform"/>
                        <TextBlock Text="{Binding Priority}" Foreground="{Binding Priority, Converter={StaticResource IndicatorColorConverter}}" FontSize="10" VerticalAlignment="Center" Margin="4,0,0,0"/>
                        <TextBlock Text="Rank #" FontSize="10" VerticalAlignment="Center" Margin="10,0,0,0"/>
                        <TextBlock Text="{Binding Index}" FontSize="10" VerticalAlignment="Center" />
                    </StackPanel>
                    <TextBlock Grid.Row="1" Text="{Binding Title}" FontWeight="Bold" FontSize="12" TextWrapping="Wrap" Margin="0,4,0,0"/>
                    <TextBlock Grid.Row="2" Text="{Binding Description}" FontSize="10" TextWrapping="Wrap" Margin="0,4,0,0"/>
                    <ItemsControl Grid.Row="3" ItemsSource="{Binding Tags}" Margin="0,6,0,0">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border Style="{StaticResource TagBorderStyle}">
                                    <TextBlock Text="{Binding}" FontSize="10"/>
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ProgressBar Grid.Row="4" Value="{Binding Progress}" Maximum="100" Height="2" Foreground="#B06A1F" Margin="0,8,0,0"/>
                </Grid>
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="ReviewCardTemplate">
            <Border CornerRadius="12" Background="#26D3453F" Padding="8" Margin="2">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2">
                        <Path Data="M8,0 A8,8 0 1 1 7.99,0 Z" Fill="{Binding Priority, Converter={StaticResource IndicatorColorConverter}}" Width="10" Height="10" Stretch="Uniform"/>
                        <TextBlock Text="{Binding Priority}" Foreground="{Binding Priority, Converter={StaticResource IndicatorColorConverter}}" FontSize="10" VerticalAlignment="Center" Margin="4,0,0,0"/>
                        <TextBlock Text="Rank #" FontSize="10" VerticalAlignment="Center" Margin="10,0,0,0"/>
                        <TextBlock Text="{Binding Index}" FontSize="10" VerticalAlignment="Center" />
                    </StackPanel>
                    <TextBlock Grid.Row="1" Text="{Binding Title}" FontWeight="Bold" FontSize="12" TextWrapping="Wrap" Margin="0,4,0,0"/>
                    <TextBlock Grid.Row="2" Text="{Binding Description}" FontSize="10" TextWrapping="Wrap" Margin="0,4,0,0"/>
                    <ItemsControl Grid.Row="3" ItemsSource="{Binding Tags}" Margin="0,6,0,0">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border Style="{StaticResource TagBorderStyle}">
                                    <TextBlock Text="{Binding}" FontSize="10"/>
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ProgressBar Grid.Row="4" Value="{Binding Progress}" Maximum="100" Height="2" Foreground="#D3453F" Margin="0,8,0,0"/>
                </Grid>
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="DoneCardTemplate">
            <Border CornerRadius="12" Background="#263C8B8E" Padding="8" Margin="2">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2">
                        <Path Data="M8,0 A8,8 0 1 1 7.99,0 Z" Fill="{Binding Priority, Converter={StaticResource IndicatorColorConverter}}" Width="10" Height="10" Stretch="Uniform"/>
                        <TextBlock Text="{Binding Priority}" Foreground="{Binding Priority, Converter={StaticResource IndicatorColorConverter}}" FontSize="10" VerticalAlignment="Center" Margin="4,0,0,0"/>
                        <TextBlock Text="Rank #" FontSize="10" VerticalAlignment="Center" Margin="10,0,0,0"/>
                        <TextBlock Text="{Binding Index}" FontSize="10" VerticalAlignment="Center" />
                    </StackPanel>
                    <TextBlock Grid.Row="1" Text="{Binding Title}" FontWeight="Bold" FontSize="12" TextWrapping="Wrap" Margin="0,4,0,0"/>
                    <TextBlock Grid.Row="2" Text="{Binding Description}" FontSize="10" TextWrapping="Wrap" Margin="0,4,0,0"/>
                    <ItemsControl Grid.Row="3" ItemsSource="{Binding Tags}" Margin="0,6,0,0">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border Style="{StaticResource TagBorderStyle}">
                                    <TextBlock Text="{Binding}" FontSize="10"/>
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ProgressBar Grid.Row="4" Value="{Binding Progress}" Maximum="100" Height="2" Foreground="#3C8B8E" Margin="0,8,0,0"/>
                </Grid>
            </Border>
        </DataTemplate>

        <local:CardTemplateSelector x:Key="CardTemplateSelector"
                                    ToDoTemplate="{StaticResource ToDoCardTemplate}"
                                    InProgressTemplate="{StaticResource InProgressCardTemplate}"
                                    ReviewTemplate="{StaticResource ReviewCardTemplate}"
                                    DoneTemplate="{StaticResource DoneCardTemplate}"/>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel Margin="10">
            <TextBlock Text="SortBy:" FontSize="12" FontWeight="SemiBold" Margin="0,0,0,2"/>
            <ComboBox SelectedIndex="0" ItemsSource="{Binding SortOptions}" x:Name="sortBySelection" Width="170" Margin="0,0,10,0"/>
            <TextBlock Text="Sorting Order :" FontSize="12" FontWeight="SemiBold" Margin="0,8,0,2"/>
            <ComboBox SelectedIndex="0" ItemsSource="{Binding SortOrder}" x:Name="sortOrderComboBox" Width="170" Margin="0,0,10,0"/>
            <TextBlock Text="Sorting Mapping Path :" FontSize="12" FontWeight="SemiBold" Margin="0,8,0,2"/>
            <ComboBox SelectedIndex="1" ItemsSource="{Binding SortMappingPath}" IsEnabled="False" x:Name="mappingPathComboBox" Width="170"/>
        </StackPanel>

        <kanban:SfKanban x:Name="kanban" Grid.Row="1"
                         BorderBrush="Transparent"
                         AutoGenerateColumns="False"
                         ColumnMappingPath="Category"
                         ColumnWidth="260"
                         SortingMappingPath="Index"
                         ColumnHeaderTemplate="{StaticResource ColumnHeaderTemplate}"
                         ItemsSource="{Binding Cards}"
                         CardTemplateSelector="{StaticResource CardTemplateSelector}">
            <kanban:KanbanColumn Title="To do" Categories="Open">
                <kanban:KanbanColumn.ErrorBarSettings>
                    <kanban:ErrorBarSettings Height="0"/>
                </kanban:KanbanColumn.ErrorBarSettings>
            </kanban:KanbanColumn>
            <kanban:KanbanColumn Title="In progress" Categories="In Progress">
                <kanban:KanbanColumn.ErrorBarSettings>
                    <kanban:ErrorBarSettings Height="0"/>
                </kanban:KanbanColumn.ErrorBarSettings>
            </kanban:KanbanColumn>
            <kanban:KanbanColumn Title="Code Review" Categories="Code Review">
                <kanban:KanbanColumn.ErrorBarSettings>
                    <kanban:ErrorBarSettings Height="0"/>
                </kanban:KanbanColumn.ErrorBarSettings>
            </kanban:KanbanColumn>
            <kanban:KanbanColumn Title="Done" Categories="Done">
                <kanban:KanbanColumn.ErrorBarSettings>
                    <kanban:ErrorBarSettings Height="0"/>
                </kanban:KanbanColumn.ErrorBarSettings>
            </kanban:KanbanColumn>
        </kanban:SfKanban>
    </Grid>
</UserControl>

```
