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

Using XAML to add elements to ChartControl

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

    Using XAML to add elements to ChartControl

    I have an addon that I wrote that puts a grid of controls next to the ChartTrader in it's own space on a chart. All the grids, buttons and labels, etc., were created in code. I'd like to use XAML to describe the grid and the controls to make it easier to modify and customize.

    All the addon examples that I've seen posted use an NTWindow to load the XAML elements by using the Content = LoadXAML(); call. I don't have an NTWindow. All I have is a Grid created like this:

    // get the grid of the chart window
    System.Windows.Controls.Grid chartGrid = chartWindow.MainTabControl.Parent as System.Windows.Controls.Grid;

    // create a new grid to hold controls
    System.Windows.Controls.Grid buttonGrid; // this holds all my elements

    // after inserting a column at the end of the chartGrid
    chartGrid.Children.Add(buttonGrid);

    How can I load my XAML elements into this buttonGrid like you do with a window? The Grid doesn't seem to have a Content like the NTWindows do.

    Thanks for any help!
    Last edited by PhineasPhred; 11-02-2020, 07:49 PM.

    #2
    Hello PhineasPhred,

    This would actually be a good situation to not use xaml because of where the controls are going to be placed. As you are not using a window the code you have shown is the most simple way to approach that. If you wanted to use xaml, you could look at how the addon sample in the help guide loads the xaml from resource and then parses it to find controls. Rather than applying that to the Content you would need to pick out the individual controls that you want and then add them like you already are.


    Please let me know if I may be of further assistance.

    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DanielTynera, Today, 01:14 AM
    0 responses
    2 views
    0 likes
    Last Post DanielTynera  
    Started by yertle, 04-18-2024, 08:38 AM
    9 responses
    40 views
    0 likes
    Last Post yertle
    by yertle
     
    Started by techgetgame, Yesterday, 11:42 PM
    0 responses
    12 views
    0 likes
    Last Post techgetgame  
    Started by sephichapdson, Yesterday, 11:36 PM
    0 responses
    2 views
    0 likes
    Last Post sephichapdson  
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,615 views
    0 likes
    Last Post aligator  
    Working...
    X