Because you're using it in an ItemsControl
, you shouldn't use a HierarchicalDataTemplate
. As MSDN states, a HierarchicalDataTemplate
:
Represents a DataTemplate that supports HeaderedItemsControl, such as TreeViewItem or MenuItem.
An ItemsControl
shows its data inside a ContentPresenter
. A TreeView
will generate TreeViewItems
, and a Menu
will generate MenuItems
.
If you want to use a DataTemplateSelector
to display different templates for items in the ItemsControl
, just set it directly as the ItemTemplateSelector
:
<ItemsControl ItemsSource="{Binding Path=Entity.EntityGroups}"
ItemTemplateSelector="{StaticResource ts}" />
If you want a hierarchical display of your data, use a TreeView
:
<TreeView ItemsSource="{Binding Path=Entity.EntityGroups}"
ItemTemplate="{StaticResource hdt}" />