I can't get work case number 1 from "SampleIndicatorTypeConverter" example when put into my strategy.
The bool "Activate" can't being recognized. I just want to hide V1 and V2 after "Activate" box is selected in Strategy Analyzer Parameters.
Sorry for asking but I being working on it all day long and I get stuck every time

Best regards,
Fernando
(hashtag)region Properties
[RefreshProperties(RefreshProperties.All)]
[Display(ResourceType = typeof(Custom.Resource), Name = "ON/Off", GroupName = "Parameters", Order = 1)]
public bool Activate
{ get; set; }
[Range(0, int.MaxValue), NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Variable 1", GroupName = "Parameters", Order = 2)]
public int V1
{ get; set; }
[Range(0, int.MaxValue), NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Variable 2", GroupName = "Parameters", Order = 3)]
public int V2
{ get; set; }
#endregion
public class MyConverter : StrategyBaseConverter
{
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object component, Attribute[] attrs)
{
PropertyDescriptorCollection propertyDescriptorCollection = base.GetPropertiesSupported(context)
? base.GetProperties(context, component, attrs)
: TypeDescriptor.GetProperties(component, attrs);
PropertyDescriptor v1 = propertyDescriptorCollection["V1"];
PropertyDescriptor v2 = propertyDescriptorCollection["V2"];
propertyDescriptorCollection.Remove(v1);
propertyDescriptorCollection.Remove(v2);
if (Activate)
{
propertyDescriptorCollection.Add(v1);
propertyDescriptorCollection.Add(v2);
}
return propertyDescriptorCollection;
}
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{ return true; }
}
Comment