Hi blanca,
Thanks for using Syncfusion products.
We suggest you to use Custom TypeConverter for Line to achieve your requirement. We have created a custom linetool with a custom line and have applied custom TypeConverter to the custom line as below.
//Custom Line class
[TypeConverter(typeof(LineTypeConverter))]
class MyLine:Line
{
public MyLine()
: base()
{
}
public MyLine(PointF ptStart, PointF ptEnd)
: base(ptStart, ptEnd)
{
}
}
//Custom LineTool
class MyLineTool:LineTool
{
internal static string ToolName = "MyLineTool";
public MyLineTool(DiagramController controller)
: base(controller)
{
this.Name = ToolName;
}
protected override Node CreateNode(System.Drawing.PointF ptStart, System.Drawing.PointF ptEnd)
{
return new MyLine(ptStart, ptEnd);
}
}
//Custom TypeConverter
class LineTypeConverter:TypeConverter
{
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
return base.ConvertTo(context, culture, value, destinationType);
}
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
Attribute[] attrs = new Attribute[]
{
new BrowsableAttribute(true)
};
PropertyDescriptor[] props = null;
Type type = value.GetType();
switch (type.Name)
{
case "MyLine":
props = new PropertyDescriptor[1];
//Show LineStyle property Only
props[0] = TypeDescriptor.CreateProperty(typeof(MyLine), "LineStyle", typeof(LineStyle), attrs);
break;
default:
break;
}
return new PropertyDescriptorCollection(props);
}
}
For your convenient, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.
Sample385445385.zipKindly try the above sample and let me know if this helps.
Regards,
Pandi Murugan A