Wpf 包含列表作为项目的列表框的数据模板不';我不能展示
我有以下列表框项目的数据模板:Wpf 包含列表作为项目的列表框的数据模板不';我不能展示,wpf,listbox,datatemplate,stackpanel,itemtemplate,Wpf,Listbox,Datatemplate,Stackpanel,Itemtemplate,我有以下列表框项目的数据模板: <DataTemplate x:Key="substanceListShower"> <ListBox ItemsSource="{Binding Items}"> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> <
<DataTemplate x:Key="substanceListShower">
<ListBox ItemsSource="{Binding Items}">
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox>
</DataTemplate>
但是在项目列表中,我得到一个ToString()返回:
System.Windows.Controls.ItemsPanelTemplate
任何帮助都将不胜感激。如果将
ItemsPanelTemplate
添加到列表框
,则您的定义缺少ListBox.ItemsPanel
标记来设置属性
ReactantInterfacesListBox.ItemTemplate = (DataTemplate)FindResource("substanceListShower");