The object may have nested objects and definitely has Brush (color) properties. I'd like the property editor to behave like the property editor for an indicator.
Is there a way to add a NinjaTrader property editor to an NTWindow to edit my object? Here's a little example code that needs to have the "blanks" filled in.
public int A { get; set; }
public SubSettings B { get; set; }
public Brush C { get; set; }
public Settings() {
A = 1;
B = new SubSettings();
C = new SolidColorBrush(Colors.WhiteSmoke);
}
}
public class SubSettings {
public int A { get; set; }
public Brush B { get; set; }
public SubSettings() {
A = 10;
B = new SolidColorBrush(Colors.Red);
}
}
class PropertyEditorWindow : NTWindow {
Settings _editingObject;
public PropertyEditorWindow() {
Caption = "Editor";
// add some control here to display properties
}
public Settings EditingObject {
get { return _editingObject; }
set {
_editingObject = value;
// do something here to display the properties of this settings object
}
}
}
static class ExampleUsage {
public static void DoExample() {
var settings = new Settings();
var editor = new PropertyEditorWindow();
editor.EditingObject = settings;
editor.Show();
}
}
Comment