Kala J
Kala J

Reputation: 2070

How can I remove the excess spacing between vertical tabs in WPF?

Right now I have a tabControl with these specifications:

<TabControl TabStripPlacement="Left" Margin="0,0,0,20" Name="TCMainWindow" DockPanel.Dock="Top" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" Height="502" Width="938">
            <TabItem Header="Import" Name="Import" Margin="0,-2,0,-7">
            </TabItem>
            <TabItem Header="Export" Name="Export" Margin="0,70,0,-87" RenderTransformOrigin="0.576,-2.45">
           </TabItem>
</TabControl>

This gives a chunk of white space between tabs. How do I remove the spacing between tabs?

I noticed that if I removed RenderTransformOrigin from the second TabItem and I manually moved it up closer to the first tab, there's still spacing between tabs.

I suppose my question is really, how do I have no spacing between the first and second vertical tabs? I don't want any space to show. Is this possible?

Upvotes: 0

Views: 787

Answers (1)

Rohit Vats
Rohit Vats

Reputation: 81233

You have explicitly set Top margin to 70 on second tabItem. Remove that and it will move up. Moreover, why do you need negative margins altogether.

<TabControl TabStripPlacement="Left" Margin="0,0,0,20" Name="TCMainWindow" 
            DockPanel.Dock="Top"
            HorizontalContentAlignment="Left" VerticalContentAlignment="Top"
            Height="502" Width="938">
    <TabItem Header="Import" Name="Import">
    </TabItem>
    <TabItem Header="Export" Name="Export" RenderTransformOrigin="0.576,-2.45">
    </TabItem>
</TabControl>

Upvotes: 1

Related Questions