I have the following .xaml:
<TreeView ItemsSource="{Binding EntityInstanceGroupings}">
<TreeView.ItemTemplate>
<DataTemplate>
<TreeViewItem ItemsSource="{Binding EntityInstances}">
<TreeViewItem.HeaderTemplate>
<DataTemplate>
<DockPanel LastChildFill="True">
<TextBlock Text="{Binding ...}" />
<Button Content="Add" DockPanel.Dock="Right" VerticalContentAlignment="Top">
...
</Button>
</DockPanel>
</DataTemplate>
</TreeViewItem.HeaderTemplate>
<TreeViewItem.ItemTemplate>
...
</TreeViewItem.ItemTemplate>
</TreeViewItem>
</DataTemplate>
</TreeView.ItemTemplate>
</TreeView>
At the line:
<TextBlock Text="{Binding ...}" />
I’m trying to bind to a property “GroupName” that is in the EntityInstanceGroupings view model. I can’t figure out to do this (if it is even possible). Any help would be greatly appreciated 🙂
You should be able to achieve this using
RelativeSource.