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 NullPointStrategies, Today, 05:17 AM
      0 responses
      52 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      48 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X