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

  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:


  • GaryAlbers
    replied
    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

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:


  • GaryAlbers
    started a topic How to package/deliver xaml for custom control?

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by Belfortbucks, Today, 09:29 PM
0 responses
3 views
0 likes
Last Post Belfortbucks  
Started by zstheorist, Today, 07:52 PM
0 responses
7 views
0 likes
Last Post zstheorist  
Started by pmachiraju, 11-01-2023, 04:46 AM
8 responses
150 views
0 likes
Last Post rehmans
by rehmans
 
Started by mattbsea, Today, 05:44 PM
0 responses
6 views
0 likes
Last Post mattbsea  
Started by RideMe, 04-07-2024, 04:54 PM
6 responses
33 views
0 likes
Last Post RideMe
by RideMe
 
Working...
X