Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I create an NT8 themed WPF form?

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

    How do I create an NT8 themed WPF form?

    I have a question regarding WPF and XAML.
    I am creating form, and want to know how to import the look that Ninjatrader will have in Visual Studio.
    Does a XAML template exist in Ninjatrader that I can import to Visual Studio that allows me to code it in visual studio, exactly the way it will look in NT8?

    #2
    Hello lakersfan,

    Thank you for the post.

    The visual studio xaml designer generally won't be able to replicate the internal addon controls or the styles of the platform due to how they are loaded in the platform. You can use the NT styles for your windows or controls but you will need to actually run the window in the platform to see it styled.

    I would suggest taking a look at the two samples in the following page. The first sample would be the general way to load and run addons with WPF, the second visual studio project would be if you wanted to use compiled xaml to access more advanced C# features. https://ninjatrader.com/support/help...t_overview.htm

    I look forward to being of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello lakersfan,

      Thank you for the post.

      The visual studio xaml designer generally won't be able to replicate the internal addon controls or the styles of the platform due to how they are loaded in the platform. You can use the NT styles for your windows or controls but you will need to actually run the window in the platform to see it styled.

      I would suggest taking a look at the two samples in the following page. The first sample would be the general way to load and run addons with WPF, the second visual studio project would be if you wanted to use compiled xaml to access more advanced C# features. https://ninjatrader.com/support/help...t_overview.htm

      I look forward to being of further assistance.
      Thanks. Do you know if more samples exist which would have buttons, scrollbar, checkbox, graphs inside a messagebox?

      Comment


        #4
        Hello lakersfan,

        Most of those type of samples with be on the forums, you can generally search for the control you are trying to use to find some examples.

        There is also the addon section of the help guide which shows some of the UI design items, this heavily relies on existing C# WPF knowledge. NinjaScript is just C# and the windows/controls are WPF/xaml so any external tutorials or education materials for those items will help.





        I look forward to being of further assistance.

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello lakersfan,

          Most of those type of samples with be on the forums, you can generally search for the control you are trying to use to find some examples.

          There is also the addon section of the help guide which shows some of the UI design items, this heavily relies on existing C# WPF knowledge. NinjaScript is just C# and the windows/controls are WPF/xaml so any external tutorials or education materials for those items will help.





          I look forward to being of further assistance.
          Thank you. I tried importiing the addon solution/project to vs, and I get this. Is this correct?

          Comment


            #6
            Hello lakersfan,

            What version of visual studio are you using?

            Generally we should see that for the controls that NinjaTrader created because they were not designed to be used in the xaml designer however I just tried this in 2019 and got the attached result.

            Older versions do have very poor ability to visualize the addon windows due to the custom controls being used. If you design the general xaml you want without the NinjaTrader controls first that is often a lot more simple so you can use the xaml designer. Another approach is to keep a second WPF window in the project to design in then copy the new xaml code into your real NT window xaml when you want to update it.

            I look forward to being of further assistance.

            Attached Files

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello lakersfan,

              What version of visual studio are you using?

              Generally we should see that for the controls that NinjaTrader created because they were not designed to be used in the xaml designer however I just tried this in 2019 and got the attached result.

              Older versions do have very poor ability to visualize the addon windows due to the custom controls being used. If you design the general xaml you want without the NinjaTrader controls first that is often a lot more simple so you can use the xaml designer. Another approach is to keep a second WPF window in the project to design in then copy the new xaml code into your real NT window xaml when you want to update it.

              I look forward to being of further assistance.
              visual studio 15

              Comment


                #8
                Originally posted by NinjaTrader_Jesse View Post
                Hello lakersfan,

                What version of visual studio are you using?

                Generally we should see that for the controls that NinjaTrader created because they were not designed to be used in the xaml designer however I just tried this in 2019 and got the attached result.

                Older versions do have very poor ability to visualize the addon windows due to the custom controls being used. If you design the general xaml you want without the NinjaTrader controls first that is often a lot more simple so you can use the xaml designer. Another approach is to keep a second WPF window in the project to design in then copy the new xaml code into your real NT window xaml when you want to update it.

                I look forward to being of further assistance.
                Unfortunately, my laptop won't upgade to 2019. Is there a workaround?

                Comment


                  #9
                  Hello lakersfan,

                  Not that I am aware of, 2019 is the first version I have used that has displayed the wpf content in the designer at all. The items I had noted in the last post would be the ways to approach xaml development for an NT window. You can make a standard xaml window that does not inherit from NTWIndow and have full access to the designer if you need to do that. The xaml can then be migrated to your NT window when you want to update it.

                  The NinjaTrader controls are not made for the visual studio designer so even if it displays the overall wpf content the NinjaTrader items were not made for that use case. The controls cause designer errors which prevent the designer from displaying the form. The addons xaml and other xaml in the platform is generally intended to be made through C# code or loaded from a .xaml file by parsing it rather than compiling, there is no intention for it to be used with the designer.



                  I look forward to being of further assistance.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Today, 05:17 AM
                  0 responses
                  38 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  124 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  64 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  41 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  46 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X