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

How to hide an item from customization?

 

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

Article ID: Published Date: Last Revised Date: Platform: Control:
1160 04/30/2011 07/10/2014 WinForms XPToolbar
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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