Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: display sorting indicator in DataGrid headers #1167

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions src/Wpf.Ui/Controls/DataGrid/DataGrid.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,23 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="0,0,1,1">
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<controls:SymbolIcon
Grid.Column="1"
Margin="5,0,0,0"
x:Name="SymbolIcon"
Filled="True"
Visibility="Hidden"
Symbol="CaretUp24" />
</Grid>
</Border>

<Thumb
Expand All @@ -515,6 +528,21 @@
HorizontalAlignment="Right"
Style="{StaticResource ColumnHeaderGripperStyle}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="SymbolIcon" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="SortDirection" Value="Ascending">
<Setter TargetName="SymbolIcon" Property="Visibility" Value="Visible" />
<Setter TargetName="SymbolIcon" Property="Symbol" Value="CaretUp24" />
<Setter TargetName="SymbolIcon" Property="Foreground" Value="{DynamicResource SystemAccentColorSecondaryBrush}" />
</Trigger>
<Trigger Property="SortDirection" Value="Descending">
<Setter TargetName="SymbolIcon" Property="Visibility" Value="Visible" />
<Setter TargetName="SymbolIcon" Property="Symbol" Value="CaretDown24" />
<Setter TargetName="SymbolIcon" Property="Foreground" Value="{DynamicResource SystemAccentColorSecondaryBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
Expand Down