我的问题是:是否可以使用GridViewColumnHeader作为CommandParameter?我有以下代码,我想使用单击的ColumnHeader作为CommandParameter:
<GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=Vorname}">
<GridViewColumnHeader Content="Vorname" Command="{Binding Path=ColumnHeaderClickCommand}"/>
</GridViewColumn>
答案 0 :(得分:1)
如果ColumnHeaderClickCommand
是ICommand
:
<GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=Vorname}">
<GridViewColumnHeader Content="Vorname" Command="{Binding Path=ColumnHeaderClickCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"/>
</GridViewColumn>