)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to hide and show ToolStripEx items dynamically in WinForms ToggleButton?

Platform: WinForms |
Control: ToggleButton |
Published Date: January 8, 2020 |
Last Revised Date: January 8, 2020

Hide or show the ToolStripEx items

In ToolStripEx, its items appearance can be customized by using its property named Visible.

C#

if(this.toggleButton1.ToggleState == Syncfusion.Windows.Forms.Tools.ToggleButtonState.Active)
{
   foreach (ToolStripItem button in this.toolStripEx1.Items)
   {
       // To hide the controls loaded in ToolStripEx
       button.Visible = false;
       this.toolStripEx1.Refresh();
   }
}
else
{
   foreach (ToolStripItem button in this.toolStripEx1.Items)
   {
       // To show the controls loaded in ToolStripEx
       button.Visible = true;
       this.toolStripEx1.Refresh();
   }
}

VB

Private Sub toggleButton1_ToggleStateChanged(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.ToggleStateChangedEventArgs) Handles toggleButton1.ToggleStateChanged
   If Me.toggleButton1.ToggleState = Syncfusion.Windows.Forms.Tools.ToggleButtonState.Active Then
     For Each button As ToolStripItem In Me.toolStripEx1.Items
         'To hide the control in ToolStripEx
         button.Visible = False
         Me.toolStripEx1.Refresh()
     Next button
   Else
     For Each button As ToolStripItem In Me.toolStripEx1.Items
         button.Visible = True
         'To show the control in ToolStripEx
         Me.toolStripEx1.Refresh()
     Next button
   End If
End Sub

                           

Hide controls dynamicall in ToolStripEx with image

Figure 1. Hide controls dynamically in ToolStripEx with image.

Show controls dynamicall in ToolStripEx with image

Figure 2. Show controls dynamically in ToolStripEx with image.

Samples:

C#: How to hide and show ToolStripEx items dynamically?

VB: How to hide and show ToolStripEx items dynamically?

2X faster development

The ultimate WinForms 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
Live Chat Icon