Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Region fill color from property ?

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

    Draw.Region fill color from property ?

    Hey Everyone,

    I have a region that I am shading between two plots. Its working well as long as I hard code the color with Brushes.Red or whatever color I want.

    I tried creating a property called RegionColor as a public Brushes.

    I then also set the default to Brushes.Red or whatever.

    I am getting an error in my code which says cannot implicitly convert type system.windows.media.soliccolorbrush to system.window.media.brushes.

    I don't exactly understand the conversion because I am setting my RegionColor type to Brushes, so when I set it to Brushes.Red as a default, I don't see why the conversion.

    Anyone have any ideas on this one?

    #2
    Hello ErikY,

    From the error it sounds like you have an incorrect type or namespace used somewhere, likely Brushes which should instead be singular or Brush.

    A simple way around this would be to generate the property using the indicator wizard. In the NinjaScript editor, create a new indicator and when the new indicator wizard opens select the user input tab. Define a brush input and click Generate. The resulting code can be copied into your existing script to replace the property that you had. Doing it this way also generates the correct serialization property for saving in templates.


    I look forward to being of further assistance.

    Comment


      #3
      Thanks, this worked! The problem I had was I was setting as Public Brushes and it was supposed to be Public Brush. The wizard set it correctly and I was able to fix it, great tip, thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, Yesterday, 10:06 AM
      0 responses
      20 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      18 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      14 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      9 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      39 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X