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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      163 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      82 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      125 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      206 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      184 views
      0 likes
      Last Post CarlTrading  
      Working...
      X