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

RadDock Contex Menu Icon

2 Answers 143 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Mahvash
Top achievements
Rank 1
Mahvash asked on 06 Aug 2013, 12:39 PM
Hi,
I use raddock and as you know when show a form it becomes a tab in raddock.
these tabs(forms) have ContextMenu that show when right click on forms header
 that contains close , close all , close all but this  and other menu items
i need to add image for this menu items
how can i do that?

2 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Aug 2013, 10:27 AM
Hello Mahvash,

Thank you for contacting Telerik Support.

You should use the ContextMenuService of the RadDock in order to customize menu items. Please have a look at the following code snippet:
public partial class Form1 : Form
   {
       public Form1()
       {
           InitializeComponent();
 
           ContextMenuService menuService = this.radDock1.GetService<ContextMenuService>();
           menuService.ContextMenuDisplaying += menuService_ContextMenuDisplaying;
       }
 
       private void menuService_ContextMenuDisplaying(object sender, ContextMenuDisplayingEventArgs e)
       {
           if (e.MenuType == ContextMenuType.DockWindow &&
               e.DockWindow.DockTabStrip is DocumentTabStrip)
           {
               for (int i = 0; i < e.MenuItems.Count; i++)
               {
                   RadMenuItemBase menuItem = e.MenuItems[i];
                    
                   if (menuItem.Name == "CloseWindow" ||
                       menuItem.Name == "CloseAllButThis" ||
                       menuItem.Name == "CloseAll" ||
                       menuItem is RadMenuSeparatorItem)
                   {
                       menuItem.Image = Properties.Resources.blue_close_icon;
                   }
               }
           }
       }
   }

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Mahvash
Top achievements
Rank 1
answered on 07 Aug 2013, 11:01 AM
Hi
That was great ..
It works correctly :)
thanks dear Desislava
Regards
Mahvash
Tags
Dock
Asked by
Mahvash
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Mahvash
Top achievements
Rank 1
Share this question
or