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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to hide the close button on particular Tab Header in TabControlExt?


User can hide the close button on specific Tab Header in TabControlExt. It can be achieved by modifying the style of TabItemExt. Here, we have used CloseButtonVisibility property of TabItemExtAdapter in TabItemExtStyle to show or hide the close button in TabItemExt header. The following code demonstrates the same.

 

Code Example: [Xaml]

 

<!--  Codes in Mainwindow xaml-->
 
<!-- Using TabControlExt -->
 
<syncfusion:TabControlExt Grid.Row="3"  x:Name="tabControlExt" ItemContainerStyle="{StaticResource ModifiedAeroTabItemExtStyle}"  CloseButtonType="Individual">
 
<!-- Close button visible on tab-->
 
<syncfusion:TabItemExt local:TabItemExtAdapter.CloseButtonVisibility="Visible"  Header="Tab1"/>
 
<!—Close button hidden on tab-->
 
<syncfusion:TabItemExt local:TabItemExtAdapter.CloseButtonVisibility="Hidden" Header="Tab2"/>
 
<syncfusion:TabItemExt local:TabItemExtAdapter.CloseButtonVisibility="Visible" Header="Tab3"/>
 
</syncfusion:TabControlExt>
 
 
<!-- ModifiedAeroTabItemExtStyle can be get from Codes in App.Xaml from attached sample-->
     
 

 

Code Example: [C#]

 

public class TabItemExtAdapter
{
public static Visibility GetCloseButtonVisibility(DependencyObject obj)
{
return (Visibility)obj.GetValue(CloseButtonVisibilityProperty);
}
 
public static void SetCloseButtonVisibility(DependencyObject obj, Visibility value)
{
obj.SetValue(CloseButtonVisibilityProperty, value);
}
 
// Using a DependencyProperty as the backing store for IsSpecialTab.  This enables animation, styling, binding, etc...
 
public static readonly DependencyProperty CloseButtonVisibilityProperty =
DependencyProperty.RegisterAttached("CloseButtonVisibility", typeof(Visibility), typeof(TabItemExtAdapter), new PropertyMetadata(Visibility.Visible));
 
}

 

Screenshot

 

MainWindow sample

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile