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!
See more
See less

Partner 728x90

Collapse

Modifications to chart WPF elements and tab considerations

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

    You can delete this thread, i found a way to get the automation id of everything

    Comment


      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.

      Comment


        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.

        Comment


          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.
          Bruce DeVault
          QuantKey Trading Vendor Services
          NinjaTrader Ecosystem Vendor - QuantKey

          Comment


            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)​

            Comment


              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

              Comment


                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.
                Jdmtrader
                NinjaTrader Ecosystem Vendor - JDM Indicators

                Comment


                  Hello Jdmtrader,

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

                  Comment


                    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

                    Comment


                      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.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        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.
                        Bruce DeVault
                        QuantKey Trading Vendor Services
                        NinjaTrader Ecosystem Vendor - QuantKey

                        Comment


                          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.

                          Comment


                            Great. I'm glad that there is a simple explanation.
                            Bruce DeVault
                            QuantKey Trading Vendor Services
                            NinjaTrader Ecosystem Vendor - QuantKey

                            Comment


                              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

                              Comment


                                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.
                                Chelsea B.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by DJ888, Today, 10:57 PM
                                0 responses
                                2 views
                                0 likes
                                Last Post DJ888
                                by DJ888
                                 
                                Started by MacDad, 02-25-2024, 11:48 PM
                                7 responses
                                158 views
                                0 likes
                                Last Post loganjarosz123  
                                Started by Belfortbucks, Today, 09:29 PM
                                0 responses
                                7 views
                                0 likes
                                Last Post Belfortbucks  
                                Started by zstheorist, Today, 07:52 PM
                                0 responses
                                7 views
                                0 likes
                                Last Post zstheorist  
                                Started by pmachiraju, 11-01-2023, 04:46 AM
                                8 responses
                                151 views
                                0 likes
                                Last Post rehmans
                                by rehmans
                                 
                                Working...
                                X