I have a TabControl which looks like this:
<TabControl x:Name="TabControl" SelectedIndex="0" ItemsSource="{Binding Diagrams}" SelectionChanged="TabControl_OnSelectionChanged">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="Test">
</TextBlock>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<drawingBoard:DrawingBoard x:Name="TheDrawingBoard" DockPanel.Dock="Top" Focusable="True"/>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
The code I extend previously was not able to create dynamic tabs and needs the object of the DrawingBoard
to do some stuff. Since I use ItemsSource I only get an object of Diagrams in my SelectionChanged
Event. How do I get the ContentTemplate.DataTemplate
object (DrawingBoard) of my currently selected tab?