0
我有以下與結構XAML文件:Button.Command不工作
<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
被擊中。
我在做什麼錯?
列表框中的列表框中的datagrid ...我不想使用您的應用程序! –
你在哪裏定義了你的DeleteCommand?用戶是否控制MyClass? – Whyllee