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"
                                  CloseButtonType="Hide"
                                  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 />
            </syncfusion:TabItemExt> 
        </syncfusion:TabControlExt>



3 Replies

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

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. 
 
 
Screenshot:   
 
 
 
Please let us know if you have any further assistance. 
 
Regards, 
Kanniyappan P 



MA Mike Allred January 24, 2020 12:26 PM

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:
 xmlns:system="clr-namespace:System;assembly=mscorlib"

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:
    <Window.Resources>
        <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.


NK Niranjan Kumar Gopalan Syncfusion Team January 27, 2020 08:51 AM

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. 

C#: 
<Application.Resources> 
        <ResourceDictionary> 
            <ResourceDictionary.MergedDictionaries> 
                <ResourceDictionary Source="/Syncfusion.Tools.WPF;component/Controls/TabControlExt/Themes/TransparentStyle.xaml"/> 
            </ResourceDictionary.MergedDictionaries> 
        </ResourceDictionary> 
    </Application.Resources> 
 



Regards, 
Niranjan Kumar 


Loader.
Live Chat Icon For mobile
Up arrow icon