Class PopupMenusManager
Provides the extended "XPContextMenu" property and manages the activation of Context Menus (PopupMenu) in the XP Menus framework.
Inheritance
Namespace: Syncfusion.Windows.Forms.Tools.XPMenus
Assembly: Syncfusion.Tools.Windows.dll
Syntax
public class PopupMenusManager : Component, IExtenderProvider, IIgnoreWorkingArea
Remarks
Using this class you can easily associate a control with a PopupMenu.
This class provides an extended property "XPContextMenu" through which you can associate a PopupMenu for any control on your form. Once set, the PopupMenusManager will automatically show the PopupMenu when the user right-clicks on the control.
Note that when this component is disposed, it will not dispose any of the associated control or PopupMenus.
Examples
Take a look at our XPToolbarsAndContextMenus sample under the Tools\Samples\Menus Package\ folder for usage example.
To associate a control with a PopupMenu use the SetXPContextMenu method in code as follows:
this.popupMenusManager1.SetXPContextMenu(this.richTextBox1, this.popupMenu2);
Me.popupMenusManager1.SetXPContextMenu(Me.richTextBox1, Me.popupMenu2)
Constructors
PopupMenusManager()
Overloaded. Creates a new instance of the PopupMenusManager class.
Declaration
public PopupMenusManager()
PopupMenusManager(IContainer)
Creates a new instance of the PopupMenusManager class and adds itself to the specified container.
Declaration
public PopupMenusManager(IContainer container)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.IContainer | container | The container into which to add. |
Remarks
This constructor is used at design-time to add a component to the form's IContainer field so that it gets disposed when the form gets disposed.
Properties
IgnoreWorkingArea
Specifies whether to ignore the working area.
Declaration
public bool IgnoreWorkingArea { get; set; }
Property Value
Type |
---|
System.Boolean |
ParentForm
Gets or sets the ParentForm for responding when parent form is a modal dialog.
Declaration
public Control ParentForm { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Control |
Methods
AttachContextMenu(Control, PopupMenu)
Declaration
protected virtual void AttachContextMenu(Control control, PopupMenu contextMenu)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | |
PopupMenu | contextMenu |
DetachContextMenu(Control)
Declaration
protected virtual void DetachContextMenu(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control |
Dispose(Boolean)
Releases the unmanaged resources used by the System.ComponentModel.Component and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
GetXPContextMenu(Control)
Returns the associated PopupMenu of the control.
Declaration
public PopupMenu GetXPContextMenu(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The control whose PopupMenu is required. |
Returns
Type |
---|
PopupMenu |
ResetParentForm()
Declaration
protected void ResetParentForm()
SetXPContextMenu(Control, PopupMenu)
Associates a PopupMenu with a control.
Declaration
public void SetXPContextMenu(Control control, PopupMenu contextMenu)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The control to associate with. |
PopupMenu | contextMenu | The PopupMenu to associate. Null to remove any association with the control. |
Remarks
The PopupMenusManager will automatically show the PopupMenu when the user right clicks on the control.
ShouldSerializeParentForm()
Indicates whether the ParentForm property is to be serialized.
Declaration
protected bool ShouldSerializeParentForm()
Returns
Type |
---|
System.Boolean |
UnWireParentForm(Control)
Declaration
protected void UnWireParentForm(Control parentForm)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | parentForm |
WireParentForm(Control)
Declaration
protected void WireParentForm(Control parentForm)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | parentForm |