This bigger code example below works. Now what I really want to route is the GridViewColumnHeader.Click
event within the EventTrigger
. Replacing MouseMove
with GridViewColumnHeader.Click
doesn't work. Any ideas on that?
<ListView ItemsSource="{Binding MyCollection}"
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseMove">
<cmd:EventToCommand
Command="{Binding FooCommand, Mode=OneWay}"
CommandParameter="{Binding}"
MustToggleIsEnabledValue="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListView.View>
<GridView>
<GridViewColumn Header="ColumnA"
DisplayMemberBinding="{Binding PropertyA}"></GridViewColumn>
<GridViewColumn Header="ColumnB"
DisplayMemberBinding="{Binding PropertyB}"></GridViewColumn>
<GridViewColumn Header="ColumnC"
DisplayMemberBinding="{Binding PropertyC}"></GridViewColumn>
</GridView>
</ListView.View>
</ListView>
I used the DataGrid instead which supports sorting by default.