Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Author custom property editors

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

    Author custom property editors

    In

    Code:
    https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?using_a_typeconverter_to_custo.htm
    the attached example (https://ninjatrader.com/support/help...verter_NT8.zip)

    shows some examples on how to customize the property grid. in particular I am referring to those where the attribute PropertyEditorAttribute is used:

    Code:
            [TypeConverter(typeof(FriendlyBoolConverter))] // Converts the bool to string values
            [PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")] // Create the combo box on the property grid
            [Display(Name = "Friendly bool", Order = 1, GroupName = "Use Case #3")]
            public bool FriendlyBool
            { get; set; }
    
    
    
            [TypeConverter(typeof(FriendlyEnumConverter))] // Converts the enum to string values
            [PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")] // Enums normally automatically get a combo box, but we need to apply this specific editor so default value is automatically selected
            [Display(Name = "Friendly Enum", Order = 8, GroupName = "Use Case #4")]
            public MyEnum EnumValue
            { get; set; }
    
    
            // Note: All these DisplayAttribute properties are required
            // Prompt is used to set what displays in the property grid and during mouseover
            [XmlIgnore]
            [Display(Name = "List values", GroupName = "Use Case #5", Order = 9, Prompt = "1 value|{0} values|Add value...|Edit value...|Edit values...")]
            [PropertyEditor("NinjaTrader.Gui.Tools.CollectionEditor")] // Allows a pop-up to be used to add values to the collection, similar to Price Levels in Drawing Tools
            [SkipOnCopyTo(true)]
            public Collection<PercentWrapper> MyListValues
            {
                get
                {
                    return myListValues;
                }
                set
                {
                    myListValues = new Collection<PercentWrapper>(value.ToList());
                }
            }
    ​
    However, I couldn't find documentation on how to use that attribute (PropertyEditorAttribute).

    By analysing the code and introspecting assemblies with VS Object Browser and ILSpy, I inferred that the attribute allows to assign to a property an editor different from the default one.
    This seems to be based on the Infragistics WpfPropertyGrid custom control.
    However, the custom editors used in the examples are classes in the NinjaTrader.Gui.Tools namespace.
    What I want to do is to develop custom WPF controls and use them as editor for properties in custom indicators/strategies.
    For example, I could have a complex custom strategy parameter (not a simple string, boolean, number or enum), and I would like to see a button in the property grid. Clicking on that button, a WPF dialog would open, allowing the user to view/edit in a custom way the value of the property.
    It seems that all the available editors in NinjaTrader.Gui.Tools are inheriting from
    System.Windows.Controls.WpfPropertyGrid.PropertyEd itor
    , but this class is not exposed to NinjaScript use.

    Is it possible to simply use a natural local WPF control with visual studio (https://learn.microsoft.com/en-us/do...orkdesktop-4.8) and then make NinjaTrader use it for a property when showing the property grid of an indicator or strategy?

    I know that another way could be writing an AddOn, however if what I am asking was possible it would be much easier to implement.
    Last edited by franco.tiveron; 11-15-2023, 11:14 PM.
    franco.tiveron
    NinjaTrader Ecosystem Vendor - franco.tiveron

    #2
    Hello Support,

    I second this request.
    Please someone respond.

    Thank you.

    Comment


      #3
      Hello franco.tiveron,

      This starts to get in a gray area of support. While a lot is possible, custom property editors are not documented and not directly supported.

      We do provide examples of any custom properties we are aware of to be helpful, but don't actively develop new examples for custom property editors at request.

      Attached is an example that demonstrates quite a few property editors.
      Attached Files
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X