Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1179
Passing context menu to user control
posted

Hi,

I have a form containing a ribbon. On that ribbon I have defined a popup menu. The form also contains a user control with an ultragrid on it. Is it possible for the parent form to pass a reference to that popup menu into the user control, so that the user control will use that popup menu as the context menu for the grid? If the grid were on the form I'd see a property "ContextMenuUltra on UltratoolbarsManager1", or such like. The usercontrol doesn't have a ultratoolbars manager on it, so the grid doesn't have that property, and even if it did, it would be for the wrong toolbars manager.

Parents
  • 18495
    Verified Answer
    posted

    Hello,

    Thank you for contacting Infragistics.

    It is possible to do what you want, but you won't be able to do it through the designer.  You will need to create a read-only property on your user control that returns the UltraGrid.  Once you've done that, you need to add a line of code in the Form.Load event handler similar to "ultraToolbarsManager1.SetContextMenuUltra(userControl11.Grid, "PopupMenuTool1")".

    As it turns out, the Windows Forms designer generates code just like that when you set the "ContextMenuUltra" property in the designer.

Reply Children
No Data