One of my data sources creates a set of values ββthat are entered in the following interface
public interface IData
{
string Name { get; }
FrameworkElement VisualElement { get; }
}
I would like to use data binding in WPF to display a collection of instances IDatain TabControlwhere the value Namebecomes the title of the tab and the value is VisualElementdisplayed as the contents of the corresponding tab.
Header binding is straightforward. I am stuck on how to define a template that allows me to display a value VisualElement. I tried a number of solutions with little success. My best attempt is as follows.
<TabControl ItemsSource="{Binding}">
<TabControl.ItemTemplate>
<DataTemplate>
<Label Content="{Binding Name}"/>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
How do I display VisualElement here?
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
I'm still very new to WPF, so I could skip the obvious here.