How to make TabControl and TabItem with raounded corner?

Don Jeong 1 Reputation point
2021-07-08T17:05:20.063+00:00

I want to make TabControl and TabItems with rounded corner.
And make the width of the TabItem bigger than default.
How to do this?113082-tabcontrol.png

Developer technologies C#
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Timon Yang-MSFT 9,606 Reputation points
    2021-07-09T02:23:43.48+00:00

    The TabControl that comes with Winform does not support this setting.

    You can customize a TabControl and redraw this control.

    Rounded corners for a Tab Control (WinForms)

    Or you can create a WPF user control and use it in your project.

        <Grid>  
            <TabControl Margin="10" BorderBrush="Gainsboro">  
                <TabControl.Resources>  
                    <Style TargetType="TabItem">  
                        <Setter Property="Template">  
                            <Setter.Value>  
                                <ControlTemplate TargetType="TabItem">  
                                    <!--The four values of CornerRadius represent the four corners of the TabItem.-->  
                                    <Border Name="Border" BorderThickness="1,1,1,0" BorderBrush="Gainsboro" CornerRadius="8,8,0,0" Margin="2,0">  
                                        <ContentPresenter x:Name="ContentSite"  
                                            VerticalAlignment="Center"  
                                            HorizontalAlignment="Center"  
                                            ContentSource="Header"  
                                            Margin="10,2"/>  
                                    </Border>  
                                    <ControlTemplate.Triggers>  
                                        <Trigger Property="IsSelected" Value="True">  
                                            <Setter TargetName="Border" Property="Background" Value="LightSkyBlue" />  
                                        </Trigger>  
                                        <Trigger Property="IsSelected" Value="False">  
                                            <Setter TargetName="Border" Property="Background" Value="GhostWhite" />  
                                        </Trigger>  
                                    </ControlTemplate.Triggers>  
                                </ControlTemplate>  
                            </Setter.Value>  
                        </Setter>  
                    </Style>  
                </TabControl.Resources>  
                <TabItem Header="General">  
                    <Label Content="Content goes here..." />  
                </TabItem>  
                <TabItem Header="Security" />  
                <TabItem Header="Details" />  
            </TabControl>  
        </Grid>  
    

    113116-capture.png

    This is a simple example. If you have more requirements for this control, you can post a new question with the windows-wpf tag.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Castorix31 90,681 Reputation points
    2021-07-09T04:53:23.677+00:00

    You can embed a Tab Control with ElementHost Class :

    113118-tabcontrol-rounded.gif

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.