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 write text in an indicator that is compatible with skins?

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

    How to write text in an indicator that is compatible with skins?

    Hi there,

    We a building an add-on and have been very careful to ensure that all our panels and windows are compatible with skins, by inheriting our styles we bind to our WPF elements from styles in the BluePrint.xaml.

    We are now wanting to write some text in an indicator. The biggest issue we have with skin compatibly here is text color. If the text is the same or close to the same color as the skins chart background color, it is either impossible or very difficult to see.

    We have used the RenderTarget.DrawTextLayout method to write the text on the chart from the indicator, passing it a SharpDX.DirectWrite.TextLayout, and SharpDX.Direct2D1.Brush objects.

    The text color is set by the SharpDX.Color object that gets passed to the SharpDX.Direct2D1.Brush.

    The only way I can see to make this compatible with skins at the moment is to somehow get/create a reference to an instance of the FontLabelBrush from the BluePrint.xaml and access it's Color values and use then to create a SharpDX.Color object of the same color.

    Questions:

    - Is this the best way to write skin compatible text on the chart, or is there an easier way to do it?

    - Do you have a code sample of how to do this?

    Thanks for your time.

    #2
    Hello codeowl,

    Thank you for your post.

    There would not be a means to pass the brush to the indicator from the Skin and would either be best to use a condition to check the Skin or much more simply use the ChartControl.Properties.ChartText brush which is the chart's configured color/brush for the text on the chart.

    For example:
    Code:
    Brush textBrush = ChartControl.Properties.ChartText;
    ChartControl.Properties: https://ninjatrader.com/support/help...properties.htm

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by techgetgame, Yesterday, 11:42 PM
    0 responses
    8 views
    0 likes
    Last Post techgetgame  
    Started by sephichapdson, Yesterday, 11:36 PM
    0 responses
    2 views
    0 likes
    Last Post sephichapdson  
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,615 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Yesterday, 05:56 PM
    0 responses
    10 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    20 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Working...
    X