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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      85 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      124 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      64 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      115 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      67 views
      0 likes
      Last Post PaulMohn  
      Working...
      X