Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Rendering speed of FrameworkElement when chart scale changes

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

    Rendering speed of FrameworkElement when chart scale changes

    I'm rendering an object to the chart using SharpDX and would like to convert it to a FrameworkElement so I can leverage its event methods. But I noticed that the FrameworkElement lags behind in rendering when the chart scale changes.

    To demonstrate this I have put together a test indicator. See attached. It renders a SharpDX FillRectangle (lime color), and a FrameworkElement (red). When you quickly change the Y scale of the chart you will see that the SharpDX FillRectangle follows along instantly. But the FrameWorkElement lags behind.

    So my question is, is there a way to render the FrameWorkElement as fast as SharpDX objects? Thanks.
    Attached Files

    #2
    Hi martyn73, thanks for your post.

    It would be recommended to keep everything in OnRender SharpDX related. WPF elements are meant to be added to the UserControlCollection once in State.Historical. What do you need to get done in OnRender that requires a grid? I can try to find a SharpDX example that will help.

    I look forward to hearing from you.

    Comment


      #3
      Hi Chris, my objects mimic something similar to a Chart Trader flag. They require left and right click mouse interactions. So I was hoping to use the Framework Elements events for this. But certainly can get around that using SharpDX as well. However, I also want to be able to control the ZIndex (Canvas.SetZIndex) of these objects when they partly overlap. So when I hover my mouse on one I can bring it to the front. Any way this is possible with SharpDX?

      Comment


        #4
        Hello martyn73,

        When using SharpDX, the ZOrder for the indicator will be used. Everything is drawn on the same "layer" but we are able to control the order we draw things within OnRender. Logic can be used in OnRender to check the coordinates of your SharpDX drawings and where the mouse cursor is, and if the mouse is over any objects, you can change the order of drawing so that particular object is drawn last and on top.

        For detecting mouse coordinates, ChartPanel.MouseMove can be subscribed. Other mouse events can be subscribed from here as well.

        An example that adds context menu items can be found here - https://ninjatrader.com/support/foru...007#post702007

        Let us know if there is anything else we can do to help.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        548 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        549 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X