w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to Track the Current Column Name and Sort Direction In WPF MVVM DataGrid

You can use following styling to get the column header.

            <Style TargetType="{x:Type

                <Setter Property="Command" 
                        Value="{Binding DataContext.MyCommand}"/>
                <Setter Property="CommandParameter" 
                        Value="{Binding Path=Content,
RelativeSource={RelativeSource Self}}"/>


                    <Trigger Property="IsPressed" Value="True">





You have to create the Command 'MyCommand' in your view model. then as the parameter of your execute method you will get column header name.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.