Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Adding menu item to ControlCenter
Collapse
X
-
Adding menu item to ControlCenter
Hi, Is there any sample code for adding a separator and menu item to the Help menu in the ControlCenter? The image shows the menu that I'd like to add to:
Tags: None
-
Hello,
Thank you for the post.
I didn't see a specific sample for this so I have created one that includes a Separator. I have included an Addon and an Indicator sample as there are some differences in getting the Control center window.
To add items into the Help menu, you would need to change the Automation ID used in the samples. Currently the samples utilize the New menu which is named "ControlCenterMenuItemNew" this can be replaced with "ControlCenterMenuItemHelp" to instead use the Help menu.
Also I will include below the code used to Print the resource keys, this is helpful when you do not know what resource may have been used for an item. In this case I needed to locate what resource is used to Style the Separator control for the default items which is "MainMenuSeparator".
Code:foreach (ResourceDictionary resourceDictionary in Application.Current.Resources.MergedDictionaries) { foreach (object key in resourceDictionary.Keys) { Print( key ); } }
JesseNinjaTrader Customer Service
-
Thanks Jesse, I'm VERY grateful to you for your very diligent and helpful reply.
Your effort has allowed me to get on with my real work instead of spending days figuring that out. I appreciate it so much.
I modified your example code for finding resources to include the resource type name. The catch block was necessary because the resource dictionary will throw an exception for certain keys.
Code:foreach (ResourceDictionary resourceDictionary in Application.Current.Resources.MergedDictionaries) { foreach (object key in resourceDictionary.Keys) { try { Print(key + ": " + resourceDictionary[key].GetType().ToString()); } catch { } } }
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, Yesterday, 06:40 PM
|
2 responses
21 views
0 likes
|
Last Post
by algospoke
Today, 07:04 PM
|
||
Started by ghoul, Today, 06:02 PM
|
3 responses
14 views
0 likes
|
Last Post Today, 06:43 PM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
45 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
7 responses
21 views
0 likes
|
Last Post Today, 06:16 PM | ||
Started by AttiM, 02-14-2024, 05:20 PM
|
10 responses
181 views
0 likes
|
Last Post
by jeronymite
Today, 06:11 PM
|
Comment