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 use custom XAML windows in charts?

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

    How use custom XAML windows in charts?



    we can add button on chart, like:

    var newControl = new System.Windows.Controls.TextBox { Name = "asd", Text ="WPF textbox", Width = 100, Background = Brushes.Green};
    myGrid.Children.Add(newControl);
    System.Windows.Controls.Grid.SetColumn((UIElement) newControl, 0);
    this.UserControlCollection.Add(myGrid);


    however, what steps need to be done (i am completely new to XAML field) to add WPF control instead of simple textbox, that has it's own .xaml file?


    so, it is like :

    var newControl = new CustomControls.CustomBox()....
    which has it's own xaml.

    #2
    Hello ttodua,

    Xaml files can be loaded with FileStream and XamlReader.Load().

    Below is a link to an example.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks ChelseasB.
      That example is totally for AddonWindow.
      Could you show me an example in this already done indicator?
      just to replace textbox with a sample WPF element which has XAML:

      Comment


        #4
        Hello ttodua,

        I don't have any examples of this for an indicator specifically but the code to read from a xaml file is not different in an indicator. This is the same in any script.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          Attached is the Long Short Toolbar buttons strategy combined with the AddonShell code for loading xaml.




          The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
          Attached Files
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Excellent NinjaTrader_ChelseaB ! thanks!
            Last edited by ttodua; 09-02-2020, 02:10 AM.

            Comment


              #7
              Hello ttodua,

              The xaml comes from the ButtonFromXamlExampleContent.xaml, which is taken from the AddonShells AddonShellPageContent.xaml file and then stripped down to just the button.

              You can probably edit with visual studio if you include the xaml file.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Well, when i "view all files" in VS, i couldnt see the way to visually modify that file: https://i.imgur.com/6PqDeOl.png

                Comment


                  #9
                  Hello ttodua,

                  While using VS is out of our realm, I suggest including it in the project. (8th menu item there).

                  As a heads up, NinjaTrader created controls will not appear correctly in the visual editor.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by lorem, Today, 09:18 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post lorem
                  by lorem
                   
                  Started by hazylizard, Today, 08:38 AM
                  4 responses
                  11 views
                  0 likes
                  Last Post hazylizard  
                  Started by geddyisodin, Today, 05:20 AM
                  2 responses
                  19 views
                  0 likes
                  Last Post geddyisodin  
                  Started by Max238, Today, 01:28 AM
                  5 responses
                  47 views
                  0 likes
                  Last Post Max238
                  by Max238
                   
                  Started by giulyko00, Yesterday, 12:03 PM
                  3 responses
                  13 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Working...
                  X