Articles in this section
Category / Section

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

1 min read

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"/>
<!-- 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));




MainWindow sample


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