Wpf 在itemtemplate中其他控件旁边显示usercontrols列表
我想显示绑定到列表框的用户控件列表 在每个usercontrol旁边应该有一个按钮Wpf 在itemtemplate中其他控件旁边显示usercontrols列表,wpf,xaml,binding,user-controls,listbox,Wpf,Xaml,Binding,User Controls,Listbox,我想显示绑定到列表框的用户控件列表 在每个usercontrol旁边应该有一个按钮 <ListBox ItemsSource="{Binding usercontrollist}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <!--usercontrol
<ListBox ItemsSource="{Binding usercontrollist}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<!--usercontrol of the current binded items-->
<Button Content="x" HorizontalAlignment="Right"></Button>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
在xaml代码中如何执行此操作假定
usercontrollist
是UserControl
的集合,那么您应该能够执行此操作:
<ContentControl Content="{Binding}" />