• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to package/deliver xaml for custom control?

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

    How to package/deliver xaml for custom control?

    In my indicator / strategy code I use a custom UserControl. In NT 7 I used to simply embed the UserControl code into the indicator code as an inner class. Compilation and delivery was easy since the UserControl code was already in the indicator code being delivered.

    In NT 8, I am not sure how to accomplish the same thing. I prefer to not have a separate delivery of a .dll.

    Can anyone recommend a way to deliver (export) my custom control along with my indicators/strategies from the Ninja export tool?

    I tried putting the .cs and .xaml files in the same directories as other indicators but had a compile error: "The name "InitializeComponent()" does not exist in current context." This is referring to a method on base class UserControl. Which is weird because UserControl is in PresentationFramework.dll which is already referenced. So, stumped there.

    Do I need to deliver the xaml as baml and somehow load it from my code?

    NT folks: have you created a way to do this?
    Is this an AddOn? If so, please point to some documentation.

    Thanks for any suggestions.
    Gary

    #2
    Hello,

    There is some documentation along with XAML examples in the help guide addons section, but there is also a sample addon that was posted here: http://ninjatrader.com/support/forum...54&postcount=8

    This shows how to load the xaml page for use in the platforms tabbed window system.

    You can of course use that as you wish but it does show a way to load xaml and reference the controls in the xaml for used with NinjaTrader items.

    because the xaml is being read from file, you could theoretically as an end product just use a string of xaml that is included in the .cs file. That could then be read and generated at compile time without the need for an external xaml file.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse,
      I am a bit confused by your statement:
      because the xaml is being read from file, you could theoretically as an end product just use a string of xaml that is included in the .cs file. That could then be read and generated at compile time without the need for an external xaml file.
      Did you really mean 'compile' time? If so, how do I get the NinjaTrader compiler to generate code from XAML at compile time?

      I suspect you meant load time. So I am guessing that in my indicator, in the Historical State, I would load the xaml? An then what? Would I cast the DependencyObject returned to be MyUserControl?

      Hope you can clear this up.

      Thanks,
      Gary

      Comment


        #4
        Hello,

        I am unsure when using the UserControl because that has the code behind .cs. The Addon example demonstrates a codebehinde-less way using a Page instead of a UserControl. in the code you load the xaml with, that basically becomes the code behind for the page you loaded.

        You are correct about the compile time, I did mean at load time as you are loading the xaml string and building it.

        regarding the casting, if you are using a Page, the code should be able to run as is. Your user control would need converted into a page without codebehind instead.

        as far as I am aware currently there is not a way to use code behind or usercontrols or is not documented at this time.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Sh00tHerMcGavin, Today, 07:39 PM
        0 responses
        3 views
        0 likes
        Last Post Sh00tHerMcGavin  
        Started by Mberg, Today, 05:13 PM
        0 responses
        1 view
        0 likes
        Last Post Mberg
        by Mberg
         
        Started by Barry Milan, Today, 01:33 PM
        2 responses
        10 views
        0 likes
        Last Post marcus2300  
        Started by NW Trader, Today, 03:42 PM
        2 responses
        8 views
        0 likes
        Last Post NW Trader  
        Started by ralett, Today, 01:42 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Working...
        X