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 Option Whisperer, Today, 09:55 AM
    1 response
    11 views
    0 likes
    Last Post bltdavid  
    Started by port119, Today, 02:43 PM
    0 responses
    1 view
    0 likes
    Last Post port119
    by port119
     
    Started by Philippe56140, Today, 02:35 PM
    0 responses
    3 views
    0 likes
    Last Post Philippe56140  
    Started by 00nevest, Today, 02:27 PM
    0 responses
    2 views
    0 likes
    Last Post 00nevest  
    Started by Jonafare, 12-06-2012, 03:48 PM
    5 responses
    3,986 views
    0 likes
    Last Post rene69851  
    Working...
    X