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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      673 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      379 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      111 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      578 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      582 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X