Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    563 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    329 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X