我有具有以下结构的 XAML 文件:
<UserControl>
<Grid>
...
<ListBox>
<ListBox.ItemTemplate>
<DataTemplate>
<Expander>
<ListBox>
<ListBox.ItemTemplate>
<DataTemplate>
<Expander>
<StackPanel>
<kb:Resizer>
<DataGrid>
<DataGrid.Columns>
...
<DataGridTemplateColumn IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Style="{StaticResource ChromelessButton}">
<Button.CommandParameter>
<MultiBinding Converter="{StaticResource MultiBindingConverter}">
<Binding />
<Binding Path="DataContext.Items" RelativeSource="{RelativeSource AncestorType=DataGrid}"/>
</MultiBinding>
</Button.CommandParameter>
<Button.Content>
<Image Source="./../Images/close.png" Width="15"></Image>
</Button.Content>
<Button.Command>
<MultiBinding Converter="{StaticResource TriggerConverter}">
<Binding Path="DataContext.DeleteCommand"
RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MyClass}}" />
<Binding />
</MultiBinding>
</Button.Command>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</kb:Resizer>
</StackPanel>
</Expander>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Expander>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>
该程序可以正确编译和执行,并且我在输出中没有收到任何错误消息,但DeleteCommand
从未受到打击。
我究竟做错了什么?