Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dictionary as input/property

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

    Dictionary as input/property

    Is it possible to have `Dictionary` as the input?
    I've tried :

    Code:
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public Dictionary<string, double> smth = new Dictionary<string, double>(){  {"start", 43.3}.  {"end", 81.03}  };
    but it doesnt show up any custom window to see/change the values.. I remember in NT7, it showed up something when Dictionary was used as input..

    #2
    Hi ttodua thanks for your post.

    I'm not sure if that can be done. I will ask a colleague to take a look tomorrow and we will reply then.

    Thanks in advance for your patience.

    Comment


      #3
      Hello ttodua,

      It looks like you had asked a similar question before and had received the answer to this question:


      The answer is the same as your other post, a type converter can be used for that purpose. To expand on the other answer, if you are looking at the sample it uses an IList as its collection, you could in theory use any type of collection so long as you use a type converter to control it similar to the sample.

      Type converters are a part of standard C# and are not specific to NinjaScript so there is very limited information on that topic in contrast to NinjaScript. You can see the linked sample for a working example in NinjaScript or also research Type Converters online to gather more details here.

      The type converter "ExpandableObjectConverter" could not be used for this purpose, this type is used to expand a class and its properties as a sub node in the property grid. To display a list or a collection of items would require the concepts from the sample here: https://ninjatrader.com/support/foru...havior?t=97919

      Please let me know if I may be of additional assistance.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      43 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      25 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      163 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      98 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      158 views
      2 likes
      Last Post CaptainJack  
      Working...
      X