开发者

WPF - two rows of tabs in a tab control - tab wrap

开发者 https://www.devze.com 2022-12-20 10:04 出处:网络
I have a WPF TabControl with a large number of tabs and they are presented in a sequential line all across the screen. Which means that a user needs to scroll sideways in order to view all the tabs.

I have a WPF TabControl with a large number of tabs and they are presented in a sequential line all across the screen. Which means that a user needs to scroll sideways in order to view all the tabs.

Is there a way to create two rows of tabs or make the long row o开发者_开发百科f tabs "wrap" into two or more rows?


Wrapping is the default behavior for TabControls. Any Style or ControlTemplate you're using that interferes with that?

The following code:

<Window x:Class="WpfApplication1.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Height="300" Width="300" AllowsTransparency="True" WindowStyle="None">
    <Grid>
        <TabControl>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
            <TabItem Header="TabItem"/>
        </TabControl>
    </Grid>
</Window>

yields

WPF - two rows of tabs in a tab control - tab wrap

0

精彩评论

暂无评论...
验证码 换一张
取 消