Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to show MainMenu items in the ToolBar like Chart window?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to show MainMenu items in the ToolBar like Chart window?

    In custom add-on windows (derived from NTWindow), items added to the MainMenu collection get displayed in a Menu control. WPF wraps each item in a MenuItem for display, but this gives the items a horrible appearance when you hover over them:

    Click image for larger version

Name:	2024-11-27 12_34_15-Window.png
Views:	133
Size:	3.6 KB
ID:	1325853
    Click image for larger version

Name:	image.png
Views:	112
Size:	22.8 KB
ID:	1325854

    How can I display MainMenu items in the ToolBar like Chart window does?​

    Click image for larger version

Name:	image.png
Views:	113
Size:	20.9 KB
ID:	1325855

    Notice the Menu and ToolBar​ controls are both added and available in the custom add-on window and Chart window visual tree. The problem is the items in the MainMenu collection are bound to the Menu control in custom add-on window, but I want them bound and displayed in the ToolBar control like Chart window does.

    Ordinarily I would do this:

    Click image for larger version

Name:	image.png
Views:	113
Size:	28.0 KB
ID:	1325856

    But this.FindFirst("PART_Menu") always returns null. How can I get a reference to the Menu control so I can hide it?

    ​​

    #2
    Hello tcdouglas,

    While I wouldn't know how to collapse the menu as it cannot be found using the FindFirst method it does look like you are adding items to the menu instead of the toolbar which would cause a difference. Have you tried using the variable for the toolbar that you found to add items to that directly?

    Comment


      #3
      I've just solved it: the ToolBar control (which can be found through it's automation id) is hosted in the same Grid panel as the Menu control (which cannot be found via it's automation id).

      So I can do this to display MainMenu items in the ToolBar instead of the Menu:​

      Click image for larger version

Name:	image.png
Views:	101
Size:	40.2 KB
ID:	1326226

      This gives identical appearance to the NT Chart window:

      Click image for larger version  Name:	image.png Views:	0 Size:	7.4 KB ID:	1325874​​
      Last edited by tcdouglas; 11-30-2024, 03:46 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      560 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      325 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      547 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X