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

How to hide an item from customization?

Platform: WinForms |
Control: XPToolbar |
Published Date: April 30, 2011 |
Last Revised Date: July 10, 2014

 

To prevent the item from being customized via Alt+Click the item should be prevented appearing from the customization dialog. Please refer the below code snippet which illustrates this:

C#

this.mainFrameBarManager1.CustomizingItemChanged += new EventHandler(mainFrameBarManager1_CustomizingItemChanged);

this.mainFrameBarManager1.CustomizationBegin += new EventHandler(mainFrameBarManager1_CustomizationBegin);

this.mainFrameBarManager1.CustomizationDone += new EventHandler(mainFrameBarManager1_CustomizationDone);

void mainFrameBarManager1_CustomizationDone(object sender, EventArgs e)

{

//throw new Exception("The method or operation is not implemented.");

// Unhide the item.

this.parentBarItem1.Visible = true;

// Make the category visible again in the customization dialog.

this.mainFrameBarManager1.CategoriesToIgnoreInCustDialog.Remove(this.parentBarItem1.CategoryIndex);

}

void mainFrameBarManager1_CustomizationBegin(object sender, EventArgs e)

{

//throw new Exception("The method or operation is not implemented.");

// Hide an item’s Category from appearing in the Customization Dialog.

this.mainFrameBarManager1.CategoriesToIgnoreInCustDialog.Add(this.parentBarItem1.CategoryIndex);

// Also hide the item itself.

this.parentBarItem1.Visible = false;

}

void mainFrameBarManager1_CustomizingItemChanged(object sender, EventArgs e)

{

//throw new Exception("The method or operation is not implemented.");

// Prevent a particular item from being Customized via Alt + Click.

if (this.mainFrameBarManager1.CustomizingItem == this.parentBarItem1)

{

this.mainFrameBarManager1.EndDragAndDropCustomizing();

}

}

VB

AddHandler MainFrameBarManager1.CustomizationBegin, AddressOf Customization_Begin

AddHandler MainFrameBarManager1.CustomizationDone, AddressOf Customization_Done

AddHandler MainFrameBarManager1.CustomizingItemChanged, AddressOf mainFrameBarManager1_CustomizingItemChanged

Private Sub mainFrameBarManager1_CustomizingItemChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MainFrameBarManager1.CustomizingItemChanged

' Prevent a particular item from being Customized via Alt + Click.

If Me.MainFrameBarManager1.CustomizingItem Is Me.ParentBarItem1 Then

Me.MainFrameBarManager1.EndDragAndDropCustomizing()

End If

End Sub 'mainFrameBarManager1_CustomizingItemChanged

Private Sub Customization_Begin(ByVal sender As Object, ByVal e As System.EventArgs) Handles MainFrameBarManager1.CustomizationBegin

' Hide an item’s Category from appearing in the Customization Dialog.

Me.MainFrameBarManager1.CategoriesToIgnoreInCustDialog.Add(Me.ParentBarItem1.CategoryIndex)

' Also hide the item itself.

Me.ParentBarItem1.Visible = False

End Sub 'Customization_Begin

Private Sub Customization_Done(ByVal sender As Object, ByVal e As System.EventArgs) Handles MainFrameBarManager1.CustomizationDone

' Unhide the item.

Me.ParentBarItem1.Visible = True

' Make the category visible again in the customization dialog.

Me.MainFrameBarManager1.CategoriesToIgnoreInCustDialog.Remove(Me.ParentBarItem1.CategoryIndex)

End Sub 'Customization_Done

Sample:

http://websamples.syncfusion.com/samples/KB/Tools.Windows/TCustom/main.htm

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.

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