Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modifications to chart WPF elements and tab considerations

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

  • Bidder
    replied
    Originally posted by bltdavid View Post

    As part of the community, why not contribute the technique that you used?
    This could be very helpful to someone else someday.

    The concept at hand in the above quote was how to obtain automation id's...

    When working with anything WPF related let your hair grow back in and use the live visual tree in Vs2019 or Vs2022


    Click image for larger version

Name:	image.png
Views:	641
Size:	37.5 KB
ID:	1292908

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Bob,

    See the regions '#region Use case #2: Custom left toolbar' in the SampleWPFModifications reference sample.

    In the CreateWPFControls() method the toolbarLeftMenuButton2 is a button that is added to the customToolBarVerticalStackPanel.
    You can also create a button and add this to the customToolBarVerticalStackPanel.

    Leave a comment:


  • bobperez
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello REI140205,

    Possibly you could set and look for AutomationID's with strings that have a incremented value.. You could use string.Substring to match the first part of the string, parse the number on the second part of the string, and this would tell you how many times that control has been added to the wpf on that tab. Each time the is added and there is already one existing, you might change the color for the new object.

    The ChartToolBarCustomMenuExample shows a little of finding and setting AutomationIds.
    Hello Chelsea,

    How can more buttons be added to the left menu panel of the WPF EXAMPLE?

    Thanks

    Bob Perez

    Leave a comment:


  • QuantKey_Bruce
    replied
    Great. I'm glad that there is a simple explanation.

    Leave a comment:


  • kkc2015
    replied
    Hi Chelsea and QuanKey_Bruce,
    Thank you both for the quick response. QuanKey_Bruce is correct that the issue is caused by monitor scaling, as the latest NT8 is installed on my laptop with 200% layout scaling. The side buttons on the NT8 charts are implemented for a 4k display and I knew that not all buttons would be visible on a 2k display.
    Thank you both again, much appreciated.

    Leave a comment:


  • QuantKey_Bruce
    replied
    You could also adjust the padding or margins. And, check if you have changed the scale and layout size of your monitor (possibly from 100% to 125% or 150%?) as this can affect how these appear as well. It is possible to program these UI elements to behave well for all different scale settings, and it's also possible to not do that, and almost certainly easier.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello kkc2015,

    You can set the Width and Height of a System.Windows.Controls.Button to be smaller.


    Note, I am not seeing this behavior with the SampleWPFModifications reference sample. Trying using the code from this example linked in the help guide from post # 1 in this thread.

    Leave a comment:


  • kkc2015
    replied
    Hello NT team,
    Based on the nice examples you have provided to implement buttons on the side of the chart, I have created a series of buttons for use on my charts. On NT8 ver.8.0.27, the buttons fitted into the grid space with room to spare on the bottom (NT8027_grid.png). However with NT8 ver.8.1.17, the size of the buttons has increased significantly (NT81117_grid1.png), which resulted in many buttons not showing on the screen.

    Is there an easy way to fix this?
    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Jdmtrader,

    ntBartopMenuItemSubItem1 = new NTMenuItem()
    {
    BorderThickness = new Thickness(0),
    Header = "Sub-MenuItem 1",
    Background = Brushes.Green
    };

    Leave a comment:


  • Jdmtrader
    replied
    Does anyone know how to modify the background color of the sub-menu items for use case #4? When you have NinjaTrader using a black or slate background, the main menu items have a background of black, but I cant figure out how to modify the background color or font color of the sub menu item menus.

    Leave a comment:


  • Entwaze
    replied
    So to extend upon this for food for thought, you could also loop through all window children and get their type then, when you hit the typeof(ChartTrader ) nice because of the object reference you can just initialize a global to that and then boom you have access to chart trader throughout your script without using findfirst with heart automation ids
    can also test:
    - Names
    - Content
    - Other elemental properties

    Leave a comment:


  • Entwaze
    replied
    I think She moved it,
    The solution i used was to go through the children in the WPF module to find them, you can do this not only with the chart window, but every element that exists that you have access.
    // GRAB MAIN WINDOW
    MAIN_CHART_WINDOW = System.Windows.Window.GetWindow (ChartControl.Parent) as Chart;

    //GRAB CHART TRADER,BUT ALSO GRAB CHART TRADER GRID, ASSIGN TO GLOBAL VARIABLES
    if (MAIN_CHART_WINDOW != null)
    {
    CHART_TRADER = (MAIN_CHART_WINDOW.FindFirst ("ChartWindowChartTraderControl") as ChartTrader);
    CHART_TRADER_GRID = CHART_TRADER.Content as Grid;
    }

    last just loop through CHARTTRADERGRID.Children , ensure that it is not null first and print the the type of each element

    get type of element with CHART_TRADER_GRID.Children[i].GetType () ; PRINT THAT SHEET
    test conditions with typeof(THE TYPE THAT YOU PRINT)​

    Leave a comment:


  • QuantKey_Bruce
    replied
    The thread belongs to NinjaTrader_ChelseaB. It is not something they would likely delete as it was created here for a reason.
    Last edited by QuantKey_Bruce; 07-03-2023, 06:13 PM.

    Leave a comment:


  • bltdavid
    replied
    Originally posted by Entwaze View Post
    You can delete this thread, i found a way to get the automation id of everything
    As part of the community, why not contribute the technique that you used?
    This could be very helpful to someone else someday.

    Leave a comment:


  • bltdavid
    replied
    Originally posted by Entwaze View Post
    You can delete this thread, i found a way to get the automation id of everything
    You may be confused between the terms thread and post.

    This thread should not (and hopefully will not) be deleted.
    It has a large amount of historical information, aka large number of postings.

    If you wish to delete your individual posts in this thread, that's entirely up to you.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by cmoran13, 04-16-2026, 01:02 PM
0 responses
51 views
0 likes
Last Post cmoran13  
Started by PaulMohn, 04-10-2026, 11:11 AM
0 responses
31 views
0 likes
Last Post PaulMohn  
Started by CarlTrading, 03-31-2026, 09:41 PM
1 response
165 views
1 like
Last Post NinjaTrader_ChelseaB  
Started by CarlTrading, 04-01-2026, 02:41 AM
0 responses
100 views
1 like
Last Post CarlTrading  
Started by CaptainJack, 03-31-2026, 11:44 PM
0 responses
160 views
2 likes
Last Post CaptainJack  
Working...
X