It's possible to create RadContextMenuManager programmatically ?

1 Answer 76 Views
Form
Alessandro
Top achievements
Rank 2
Iron
Iron
Iron
Alessandro asked on 08 Sep 2022, 03:18 PM

Hi ,

I need to create RadContextMenuManager programmatically in a "base" RadForm ( wich is inherited by other Forms Classes).

I don't want to add it with the designer.

It's possible?

If i add a property RadContextMenuManager, i cannot see this.RadContextMenu .

Alessandro

1 Answer, 1 is accepted

Sort by
1
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Sep 2022, 04:48 AM

Hello, Alessandro,

RadContextMenuManager is designed to be used at design time as it affects the Visual Studio Properties section. This component will add a RadContextMenu property to all controls on the form. 

If you want to assign a context menu for a control at run time, please refer to the following help article which demonstrates how to achieve it:

https://docs.telerik.com/devtools/winforms/controls/menus/contextmenu/add-context-menu-in-code 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Alessandro
Top achievements
Rank 2
Iron
Iron
Iron
commented on 16 Sep 2022, 02:12 PM

Thank you Dess, 

It's working, but... now i have this problem: the radContextMenu remains opened and i don't know how to close it ( and especially *when* )

 

Alessandro

Dess | Tech Support Engineer, Principal
Telerik team
commented on 16 Sep 2022, 02:31 PM

Alessandro, please have in mind that by default the context menu is expected to be automatically closed if you click an item on it or click elsewhere on the form. However, with the latest version R3 2022 we have a known issue about closing the context menu only for .NET6 projects. Here is the feedback item for your reference: https://feedback.telerik.com/winforms/1579852-radcontextmenu-dropdown-is-not-closed-when-clicking-outside-the-popup

Could you please confirm whether you have the same scenario on your end?

 
Alessandro
Top achievements
Rank 2
Iron
Iron
Iron
commented on 16 Sep 2022, 02:54 PM

I also tried adding a radContextMenuManager to the form, and doing


this.radContextMenuManager1.SetRadContextMenu (this, this.radContextMenu);

where "this.radContextMenu" is the menu I build

but the menu opens ... and if I click outside it doesn't close. And above all: I don't know how to close it. And even if I knew how to close it, I would have to manage a "click outside" context menu event

Why is it so complicated? I don't understand
Alessandro
Top achievements
Rank 2
Iron
Iron
Iron
commented on 16 Sep 2022, 03:04 PM

Thanks Dess,
Now I understand.
Excuse me, but for a moment I thought it was so "by design", in which case I would not have understood.
If it is a known bug then everything is clearer to me.

Thank you. I'll check for updates to see if it gets fixed.

 

 

Tags
Form
Asked by
Alessandro
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or