Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
Highlight Sorted Column
posted

Hi!

Does someone know how I can highlight the sorted Column of my Grid? If I click on the header of a column it is sorted automatically and then a small arrow is displayed next to the header, so you know that the grid is sorted by this column. But I like to highlight the whole column that is sorted at the moment.

Can someone help me please?

 

Thx

  • 1405
    Verified Answer
    posted

    Hi.

    I used this to highlight the cells:

    <Style x:Key="GridCell" TargetType="{x:Type dataPresenter:CellValuePresenter}">

    <Setter Property="BorderBrush" Value="#EDEDEB"/>

    <Setter Property="BorderThickness" Value="1"/>

    <Style.Triggers>

    <Trigger Property="SortStatus" Value="Ascending">

    <Setter Property="Background" Value="#F7FAFE"/>

    </Trigger>

    <Trigger Property="SortStatus" Value="Descending">

    <Setter Property="Background" Value="#F7FAFE"/>

    </Trigger>

    </Style.Triggers>

    </Style>

    And this to highlight the header:

    <Style x:Key="GridHeader" TargetType="{x:Type dataPresenter:LabelPresenter}">

    <Setter Property="Foreground" Value="#333333"/>

    <Setter Property="Background">

    <Setter.Value>

    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">

    <GradientStop Color="#FCFCFC" Offset="0" />

    <GradientStop Color="#EFEFEF" Offset="1" />

    </LinearGradientBrush>

    </Setter.Value>

    </Setter>

    <Style.Triggers>

    <Trigger Property="SortStatus" Value="Ascending">

    <Setter Property="Background" Value="#E9EFF9"/>

    </Trigger>

    <Trigger Property="SortStatus" Value="Descending">

    <Setter Property="Background" Value="#E9EFF9"/>

    </Trigger>

    </Style.Triggers>

    </Style>

     Maybe you will need to set other colors for more visibility. Hope this helps.

    Nico