假设我有一个 XAML 标记,如下所示。如何将按钮的命令参数绑定到每一行。请显示最合适的绑定表达式。
<ListView ItemsSource="{Binding Items}">
<ListView.View>
<GridView>
<GridViewColumn Header="Items" Width="Auto">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name, Mode=OneWay}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="" Width="Auto">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button MinWidth="100" Command="{Binding DeleteCommand}" CommandParameter="{Binding <EXPRESSION>}" >Delete</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<ListView.View>
</ListView>