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

how to work with grids?

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

    how to work with grids?

    Hello
    I haven't yet understood how to work with grids. Taking this example, I would like to know."https://forum.ninjatrader.com/forum/...785#post771785


    Code:
    //Line 83
        System.Windows.Controls.Grid chartTraderGrid = ((Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader).Content as System.Windows.Controls.Grid).Children[0] as System.Windows.Controls.Grid;
    
    
    
    
                BuyMarketButton = chartTraderGrid.FindFirst("ChartTraderControlQuickBuyMarketButton") as System.Windows.Controls.Button;
    
                SellMarketButton = chartTraderGrid.FindFirst("ChartTraderControlQuickSellMarketButton") as System.Windows.Controls.Button;
    
                Print(chartTraderGrid.RowDefinitions.Count);​
    I have several questions that I haven't found an answer to:
    1. Is it possible to find the names "ChartTraderControlQuickSellMarketButton, ChartTraderControlQuickBuyMarketButton..." without using Inspect?
    2. How do I iterate through the elements (next, previous,last)?
    3. I have add this line:
      Code:
       Print(chartTraderGrid.RowDefinitions.Count);
      The result is 11, but I don't know how it found 11 rows in the chart.

      thank for your help

    #2
    Hello aekzof,

    You would need to use inspect or Accessibility Insights to locate ids in the platform. That is the easiest way to locate ids by selecting a specific control. Unless you know C#/ WPF very well to write your own C# logic to navigate the visual tree that would be the only way. This is something you could research in external C# websites if you wanted to learn more about automation ids and the WPF visual tree.

    Your print is printing the count of the definitions in the grid, there are 11 rows in your current grid. The grid you are looking at is the chart trader control which has many rows and columns to support the other WPF controls it contains.

    You can learn more about using WPF grids in external C#/WPF learning resources.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,983 views
    3 likes
    Last Post jhudas88  
    Working...
    X