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 to use webview2 in wpf of addon development

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

    How to use webview2 in wpf of addon development

    Based on NinjaTraderAddOnProject, I added the microsoft webview2 library from nuget. And add xmlns defined in the root element

    <t:NTTabPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:t="clr-namespace:NinjaTrader.Gui.Tools;assembly=NinjaTrad er.Gui"
    xmlns:system="clr-namespace:System;assembly=mscorlib"
    xmlns:TradePerformance="clr-namespace:NinjaTrader.Gui.TradePerformance;assembl y=NinjaTrader.Gui"
    xmlns:AccountData="clr-namespace:NinjaTrader.Gui.AccountData;assembly=Nin jaTrader.Gui"
    xmlns:AtmStrategy="clr-namespace:NinjaTrader.Gui.NinjaScript.AtmStrategy; assembly=NinjaTrader.Gui"
    xmlns:webview2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Micr osoft.Web.WebView2.Wpf"
    x:Class="NinjaTraderAddOnProject.AddOnPage" >

    Then I add a webview2 node before accountSelector

    <webview2:WebView2 Width="1024" Height="768" Source="https://www.google.com" />
    <!-- ACCOUNT SECTION -->
    <t:AccountSelector x:Name="accountSelector" Grid.Row="1">
    <t:AccountSelector.Margin>
    <Thickness Left="{StaticResource MarginBase}" Top="{StaticResource PaddingColumn}" Bottom="0" Right="{StaticResource MarginBase}" />
    </t:AccountSelector.Margin>
    </t:AccountSelector>

    Finally build the project and generate NinjaTraderAddOnProject.dll, then put it with webview2 dlls into NinjaTrader custom directory. And reboot NinjaTrader.
    However when I launch the addon, the webview instance just occupy the position (1024x768), but not to display the google website.
    So how to do it collectly?

    #2
    Hello zzeric,

    Using this 3rd party assembly would be outside of what is supported by the NinjaScript Engineering support team, however this thread will remain open for any community members that would like to provide insight.

    Some general direction is written in the post below.
    Hi NT, I am trying to add System.Text.Json file in NinjaTrader. However, It is throwing an error : Could not load file or assembly 'System.Text.Json, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. The parent .NET version is the same
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I cannot say certainly what your method in the webview2 is, if you want to access a website by entering a link and then having a browser open, you can just hard code a websites address to a button and have that populate on part of the chart toolbar and press that, you can, I assume, also make an addon that will be accessible to change the link address if there needs to be more than one website connected through pressing the button.
      That is more of an assumption as the use-case to me is generally that you are using the addon/method to open a browser while inside a chart.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by TradeSaber, Today, 07:18 AM
      0 responses
      7 views
      0 likes
      Last Post TradeSaber  
      Started by PaulMohn, Today, 05:00 AM
      0 responses
      9 views
      0 likes
      Last Post PaulMohn  
      Started by ZenCortexAuCost, Today, 04:24 AM
      0 responses
      6 views
      0 likes
      Last Post ZenCortexAuCost  
      Started by ZenCortexAuCost, Today, 04:22 AM
      0 responses
      3 views
      0 likes
      Last Post ZenCortexAuCost  
      Started by SantoshXX, Today, 03:09 AM
      0 responses
      17 views
      0 likes
      Last Post SantoshXX  
      Working...
      X