WPF TabControl Position Tabs in the top right corner

Aaron picture Aaron · Feb 3, 2010 · Viewed 8.9k times · Source

I have a WPF TabControl that I want to position the tabs with a TabStripPlacement of Top, but I want them to display with a right orientation on top. I've achieved that easily by doing a FlowDirection of RightToLeft; however, I don't want the children controls to inherit the RightToLeft FlowDirection.

Is there any way to position the tabs on the top on the right without using the FlowDirection property?

Answer

Rhyous picture Rhyous · Mar 19, 2014

This question is old, but it is what came up when I google searched. The answer wasn't really what I wanted. So I researched this in Expresion Blend. I determined that the TabPanel needs to have HorizontalAlignment="Right" style. So for future, it is as easy as this:

<TabControl>
    <TabControl.Resources>
        <Style TargetType="TabPanel">
            <Setter Property="HorizontalAlignment" Value="Right"/>
        </Style>
    </TabControl.Resources>
    <TabControl.Items>
        <TabItem Header="Tab 1"></TabItem>
        <TabItem Header="Tab 2"></TabItem>
        <TabItem Header="Tab 3"></TabItem>
    </TabControl.Items>
</TabControl>

Let me know if you see any issues with this.