Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cannot convert type 'SharpDX.Direct2D1.Brush' to 'System.Windows.Media.Brush'

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

    Cannot convert type 'SharpDX.Direct2D1.Brush' to 'System.Windows.Media.Brush'

    Hi,
    I am setting a color in onrender method and want to take that color and update the color of my candle. I an trying to use CandleOutlineBrushes on onupdate method.


    I am getting this error ---- Cannot convert type 'SharpDX.Direct2D1.Brush' to 'System.Windows.Media.Brush'

    onupdate
    private Brush currCandleColor;


    onrender
    SharpDX.Direct2D1.Brush customBrush = Brushes.DarkGoldenrod.ToDxBrush(RenderTarget);
    currCandleColor = (Brush)customBrush;
    Thanks in advance

    #2
    Right, because currCandleColor is a System.Windows.Media.Brush.

    You should be doing currCandleColor = Brushes.DarkGoldenrod. Or, change the definition of currCandleColor to be a SharpDX.Direct2D1.Brush instead (I don't really recommend this unless you TRULY know what you are doing, because it is easy to cause problems this way).

    You can't convert from a SharpDX brush back to a system brush like that just by casting it.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Thanks Bruce.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      175 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      331 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      253 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      356 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      183 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X