Skip to content

Instantly share code, notes, and snippets.

@ciniml
Last active May 19, 2018 11:31
Show Gist options
  • Select an option

  • Save ciniml/eff69a048c071106ec48d85ab3f0f2c5 to your computer and use it in GitHub Desktop.

Select an option

Save ciniml/eff69a048c071106ec48d85ab3f0f2c5 to your computer and use it in GitHub Desktop.
TabControl ItemsSource
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<TabControl ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=TabItems}">
<TabControl.ContentTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="Text"/>
<TextBlock Text="{Binding}"/>
</StackPanel>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</Grid>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment