RadDock Contex Menu Icon

3 posts, 0 answers
  1. Mahvash
    Mahvash avatar
    3 posts
    Member since:
    Aug 2013

    Posted 06 Aug 2013 Link to this post

    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. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 07 Aug 2013 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mahvash
    Mahvash avatar
    3 posts
    Member since:
    Aug 2013

    Posted 07 Aug 2013 Link to this post

    Hi
    That was great ..
    It works correctly :)
    thanks dear Desislava
    Regards
    Mahvash
Back to Top