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

ImageBrush

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

  • aligator
    replied
    Originally posted by NinjaTrader_Jim View Post

    Unsupported code attached, use at your own risk! (image1.jpg needs to be in Documents/NinjaTrader 8/)
    Hi Jim,

    Great! Now I can blog my trades from Pacific islands

    Cheers!
    Attached Files

    Leave a comment:


  • NinjaTrader_Jim
    replied
    Hello jshapen,

    I have gotten some clarification from Product Management.

    The entire area on a chart (ChartControl, all ChartPanels, and Price/Time Scales) is rendered via SharpDX. When ChartControl.Background is set in skin, ChartControl.Properties.BackgroundBrush will inherit the SolidColorBrush from ChartControl.Background. An ImageBrush could not be used since ImageBrushes do not exist for SharpDX rendering.

    The threading error is different considering the thread in which the ImageBrush is created and the UI thread that would use it. A Dispatcher could be used to create and set the brush on the appropriate thread, however we have other documented/supported means to set ChartControl's background brush to a supported brush. (ImageBrushes still could not be used for this instance)

    In short, setting an ImageBrush for ChartControl.Background through the skin xaml is not possible because that part of the window is rendered with DirectX.

    Furthermore, SharpDX rendering internally will clip all rendering to the NinjaScript's ChartPanel. This will need to be circumvented to render to the entire ChartControl area.

    In order to accomplish the goal of setting the background to an image, you would have to use SharpDX rendering, use unsupported code to pop out of the clip rect and use your own, draw the image, and then set the clip rect back to the ChartPanel bounds.

    Popping out of the clip rect is highly unsupported and will break hit testing with the NinjaScript among other things like gridlines. It will work enough for a standalone indicator, but I would not recommend doing this with an actual indicator.

    Unsupported code attached, use at your own risk! (image1.jpg needs to be in Documents/NinjaTrader 8/)

    We have a pending feature request to be able to apply images to ChartControl.Background, and I'll make sure we have your interest tracked on this item since the approach to accomplish this is not supported. I'll also note your interest to set via skin. The ticket ID is SFT-554.

    We cannot offer an ETA or promise of fulfillment, but we are tracking interest and the ticket ID number will be noted in the help guide when a new build gets released with the feature implemented.

    Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

    If there is another item we can provide assistance with, please let us know.
    Attached Files

    Leave a comment:


  • NinjaTrader_Jim
    replied
    Hello jshapen,

    Thanks for your post.

    I've done some testing to try and accomplish this both in skin and in code. I see the threading error you are referring to and I also see that I currently cannot set ChartControl.Background to the ImageBrush in code and achieve the intended result. (In code, we would use ChartControl.Properties.BackgroundBrush, but this will not accept an ImageBrush)

    I'm currently checking with other teammates to see if the threading error is expected and if there are any suggested ways to set a background image for the entire ChartControl.

    Thanks in advance for your patience.

    Leave a comment:


  • jshapen
    started a topic ImageBrush

    ImageBrush

    Is it possible to use ImageBrush in xaml skins files?
    I tried replacing in the ChartControl.xaml
    Code:
    <SolidColorBrush	x:Key="ChartControl.ChartBackground"				Color="#1e1e1e"			po:Freeze="true" />
    to
    Code:
    <ImageBrush ImageSource="image1.jpg"	x:Key="ChartControl.ChartBackground"	po:Freeze="true" />
    but I get an error

    The calling thread cannot access this object because a different thread owns it.

Latest Posts

Collapse

Topics Statistics Last Post
Started by elderan, Today, 08:03 PM
0 responses
3 views
0 likes
Last Post elderan
by elderan
 
Started by algospoke, Today, 06:40 PM
0 responses
10 views
0 likes
Last Post algospoke  
Started by maybeimnotrader, Today, 05:46 PM
0 responses
9 views
0 likes
Last Post maybeimnotrader  
Started by quantismo, Today, 05:13 PM
0 responses
7 views
0 likes
Last Post quantismo  
Started by AttiM, 02-14-2024, 05:20 PM
8 responses
169 views
0 likes
Last Post jeronymite  
Working...
X