I am trying to add a new property to a new CustomBarsType so it will be shown in the data series grid.
I implemented a basic CustomPropertyDescriptor and I am trying to add a new property in State.Configure but it is not displayed in the data series grid.
I will need to add more properties in the future (int, double, bool) so I will not be able to reuse the existing ones.
I am not sure what I am missing.
Thank you all in advance.
public class CustomPropertyDescriptor : PropertyDescriptor { public int CustomParam { get; set; } public CustomPropertyDescriptor(int value) : base("CustomParam", null) { CustomParam = value; } public override AttributeCollection Attributes { get { return new AttributeCollection(null); } } public override bool CanResetValue(object component) { return true; } public override Type ComponentType { get { return CustomParam.GetType(); } } public override string DisplayName { get { return "Custom Param"; } } public override string Description { get { return "Custom Description"; } } public override object GetValue(object component) { return CustomParam; } public override bool IsReadOnly { get { return true; } } public override string Name { get { return "CustomParam"; } } public override Type PropertyType { get { return CustomParam.GetType(); } } public override void ResetValue(object component) { } public override bool ShouldSerializeValue(object component) { return true; } public override void SetValue(object component, object value) { CustomParam = (int)value; } } public class CustomBarsType : MinuteBarsType { protected override void OnStateChange() { base.OnStateChange(); if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Bars type here."; Name = "CustomBarsType"; BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType)15, Value = 1 }; BuiltFrom = BarsPeriodType.Minute; DaysToLoad = 5; IsIntraday = true; } else if (State == State.Configure) { if (Properties != null) { if (Properties.Find("CustomParam", true) == null) Properties.Add(new CustomPropertyDescriptor(123)); } } } }
Comment