I want to popup a custom WPF window to use as an editor from the indicator selector propertygrid. I have a working example in a stand alone WPF project using the System.Windows.Controls.WpfPropertyGrid.dll.
It uses the following method:
The property grid binds to the following object:
<pg:PropertyGrid SelectedObject="{StaticResource BusinessObject}" ShowReadOnlyProperties="True"/>
public class BusinessObject : INotifyPropertyChanged { ... [PropertyEditor(typeof(TestWindowPicker))] [PropertyOrder(4)] public string TestWindow { get { return testWindow; } set { if (testWindow == value) return; testWindow = value; OnPropertyChanged("TestWindow"); } } ... } }
public class TestWindowPicker : PropertyEditor { public TestWindowPicker() { this.InlineTemplate = EditorKeys.FilePathPickerEditorKey; } public override void ShowDialog(PropertyItemValue propertyValue, IInputElement commandSource) { if (propertyValue == null) return; if (propertyValue.ParentProperty.IsReadOnly) return; TestWindow tw = new TestWindow(); tw.TestString = propertyValue.StringValue; if (tw.ShowDialog() == true) { propertyValue.StringValue = tw.TestString; } } }
I have tried this approach with a property in my Indicator class, and the property does show on the NT Indicator selection dialogue, however the ellipse button [...] to launch the TestWindow does not appear, instead there is just a textbox.
The property in my indicator code is as follows:
[NinjaScriptProperty] [Display(Name = "Test_String", Description = "Test String", Order = 2, GroupName = "Parameters")] [PropertyEditor(typeof(TestWindowPicker))] public string Test_String { get; set; }
Thank you for your time.
Comment