Search code examples
wpftabcontrolchildren

Children Tabs in Wpf


I have been looking for a way to implement a child tab control inside a tab control(sort of like multi level tab controls).

but haven't found any materials for that, i can implement dynamically that at run time in Xaml.cs though, but i want to define it into Window.Xaml only, so that i can embed my controls into it.

Figure Below is an sample of the ui.

enter image description here

Kindly Suggest me the way to do it.


Solution

  • This will work for you.

    <TabControl>
        <TabItem Header="Tab1">
            <TabControl Margin="10">
                <TabItem Header="Tab1">
                    <TabControl Margin="20">
                        <TabItem Header="Tab1">
                            <StackPanel HorizontalAlignment="Center"
                                        VerticalAlignment="Center">
                                <DockPanel >
                                    <TextBlock Text="Name:" VerticalAlignment="Center" DockPanel.Dock="Left"></TextBlock>
                                    <TextBox Text="Nitesh" Margin="10,0,0,0" DockPanel.Dock="Right"></TextBox>
                                </DockPanel>
                                <StackPanel Orientation="Horizontal" Margin="10">
                                    <Button Margin="5">OK</Button>
                                    <Button Margin="5">Cancel</Button>
                                </StackPanel>
                            </StackPanel>
                        </TabItem>
                        <TabItem Header="Tab2"></TabItem>
                    </TabControl>
                </TabItem>
                <TabItem Header="Tab2"></TabItem>
            </TabControl>
        </TabItem>
        <TabItem Header="Tab2"></TabItem>
    </TabControl>