We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Need to center text in the tab (TabControlExt)

My image automatically centers, but my text is left aligned. How do I center the text? It seems that center should be the default anyway . . .

What am I missing here?

My code:

        <syncfusion:TabControlExt Name="tabMain" Grid.Row="1" Grid.Column="0" VerticalAlignment="Stretch" Grid.ColumnSpan="2" TabStripPlacement="Top"
                                  TabScrollStyle="Extended" TabScrollButtonVisibility="Visible"
                                  syncfusion:SkinStorage.VisualStyle="Transparent" >
            <syncfusion:TabItemExt Name="pgtPartMaster" Header="Part Master" HorizontalContentAlignment="Center" HorizontalAlignment="Center"
                                   Width="150" Height="70" HeaderMargin="0,5,0,0"
                                   Image="Images/PartMaster.png" ImageAlignment="AboveText" ImageHeight="30" ImageWidth="30" IconMargin="0,10,0,0" >
                <Grid />

3 Replies

KP Kanniyappan Panneer Selvam Syncfusion Team January 24, 2020 11:34 AM UTC

Hi Mike, 
Thanks for contacting the Syncfusion support. 
We checked your query “Need to center the header text in the tab item” and we have prepared the sample to meet your requirements by overriding the tab item style template. Please find the sample and screenshot for the same. 
Please let us know if you have any further assistance. 
Kanniyappan P 

MA Mike Allred January 24, 2020 05:26 PM UTC

Thanks for the example. Do you have an example that uses WPF and .NET Core 3.0?

When I copy your code in I get these messages:

On the line:

I'm told:
 Undefined CLR namespace. the clr-namespace URI refers to a namespace 'System'  that could not be found

On the 2nd line here:
        <Style TargetType="{x:Type syncfusion:TabItemExt}" BasedOn="{StaticResource TransparentTabItemExtStyle}">

I'm told:
 The recource "TransparentTabItemExtStyle" could not be resolved.

There are many more like this 2nd one.

I've tried installing the Syncfusion.Themes.Office2010Blue.WPF NuGet package. I also have Syncfusion.Share.WPF and Syncfusion.Tools.WPF installed.

UN Unknown Syncfusion Team January 27, 2020 01:51 PM UTC

Hi Mike , 

Thanks for your patience. 

We have created the requested sample in WPF .Core project and please add the below code in App.xaml. Please refer the attached sample for same. 

                <ResourceDictionary Source="/Syncfusion.Tools.WPF;component/Controls/TabControlExt/Themes/TransparentStyle.xaml"/> 

Niranjan Kumar 

Live Chat Icon For mobile
Up arrow icon