我的问题是这样的:约束字符串列表不显示字符串
我有有字符串的ObservableCollection,它获取由选定的子居住的类。
这些应该列在列表框中。
但是没有列出字符串,而是显示了FilterList中的对象类型。
<ListBox Grid.Row="2" Grid.Column="0"
ItemsSource="{Binding FilterList}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel IsItemsHost="True"
Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding ListOfActiveFilters}">
<!--<ContentPresenter Content="{Binding ListOfActiveFilters.}"/>-->
<TextBlock Text="{Binding}" />
</HierarchicalDataTemplate>
</ListBox.ItemTemplate>
</ListBox>
过滤器列表包含具有ListOfActiveFilters作为属性的类。 我认为它会按照我展示的方式工作,但事实并非如此。因为这也是我看到别人这样做的方式。
如果我要使用一个具有单个字符串Property的类作为Collection的类型而不是字符串的集合,我现在已经有了,我认为它会起作用。
我只是没有真正看到创建一个持有字符串属性的类,以便我可以将ContentPresenter或TextBox绑定到该属性。
我在做什么错?我对这个话题颇为陌生。
好吧,我不知道。 谢谢 – SireChicken