Articles in this section
Category / Section

How to display and position image in new button of TabControlExt

1 min read

Image can be displayed in the new button of TabControlExt using NewButtonStyle

Property and position of the image in new button can be changed using ImageAlignment 

Property.

 

<Window.Resources>
   <Style TargetType="syncfusion:TabItemExt" x:Key="mystyle">
            <Setter Property="syncfusion:TabItemExt.Image" Value="download.jpg"/>
            <Setter Property="syncfusion:TabItemExt.ImageHeight" Value="15"/>
            <Setter Property="syncfusion:TabItemExt.ImageWidth" Value="15"/>
            <Setter Property="syncfusion:TabItemExt.ImageAlignment"        
                    Value="RightOfText"/>
   </Style>
</Window.Resources>
<syncfusion:TabControlExt  Name="tabcontrol" IsNewButtonEnabled="True"  
                           NewButtonClick="TabControlExt_NewTabItemClick" 
                           NewButtonStyle="{StaticResource mystyle}">
<syncfusion:TabItemExt Name="tab1" Header="Tab1" Image="images1.jpg" ImageHeight="15" 
                       ImageWidth="15"/>
<syncfusion:TabItemExt Name="tab2" Header="Tab2" Image="download.jpg" ImageHeight="15"   
                       ImageWidth="15"/>                                       
</syncfusion:TabControlExt>
 

 

 

private void TabControlExt_NewTabItemClick(object sender, EventArgs e)
{
  TabItemExt item = new TabItemExt
  {
    Header="Tab" + (tabcontrol.Items.Count +1),
    Image = new BitmapImage(new Uri("images.png",UriKind.RelativeOrAbsolute)),
    ImageHeight = 15,
    ImageWidth = 15,
    ImageAlignment=ImageAlignment.RightOfText,
  };
  tabcontrol.Items.Add(item);
}
 

 

Output

 

 

 

 

        

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied