This is a migrated thread and some comments may be shown as answers.

How to get RadTabbedFormControlTab in ContextMenuOpening?

3 Answers 40 Views
TabbedForm
This is a migrated thread and some comments may be shown as answers.
Serg
Top achievements
Rank 1
Veteran
Serg asked on 13 Jan 2021, 05:27 AM

How do I get the RadTabbedFormControlTab in the ContextMenuOpening on which the context menu was called?

RadTabbedFormControl.ContextMenuOpening += (obj, arg) => {
                arg.TabItem // There is only a TabItem, which is not a RadTabbedFormControlTab :(
};

 

I would like to get the tab on which the menu was called

3 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Jan 2021, 06:04 AM

Hello, Serg,   

In order to get the RadTabbedFormControlTab in the ContextMenuOpening event, you can use the following code snippet: 
        private void radTabbedFormControl1_ContextMenuOpening(object sender, RadTabbedFormControlItemConextMenuOpeningEventArgs e)
        {
            RadTabbedFormControlTab tab = e.TabItem.Tab;
            Console.WriteLine(tab.Text);
        }
I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Serg
Top achievements
Rank 1
Veteran
answered on 13 Jan 2021, 06:21 AM
Thank you so much! Can you please tell me how to add RadMenuItem to the top of the list?ContextMenu.Items.Prepend doesn't work for some reason.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Jan 2021, 07:57 AM
Hello, Serg,   

Please refer to the code snippet below how to insert a menu item in the context menu: 
        private void radTabbedFormControl1_ContextMenuOpening(object sender, RadTabbedFormControlItemConextMenuOpeningEventArgs e)
        {
            RadMenuItem item = new RadMenuItem("My Item");
            e.ContextMenu.Items.Insert(0, item);
        }

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TabbedForm
Asked by
Serg
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Serg
Top achievements
Rank 1
Veteran
Share this question
or