We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

PropertyEditor disabled properties

Hi,

I want to disabled or to hide some properties in my PropertyEditor, is it possible?

Thanks in advanced,

Blanca




1 Reply

AA Amsath Ali M Syncfusion Team April 25, 2012 07:29 AM UTC

Hi Blanca,

Thanks for using Syncfusion products.

Currently there is no direct option to remove/disable some properties of a node in property editor. However you can achieve this by creating custom nodes and add the properties which are required for that node to the property editor by creating a customTypeConvertor class inheriting from the base TypeConvertor class. Please refer the below code snippet to achieve your requirement.

Here is the code:
[C#]

RectangleNode rect = new RectangleNode(150, 100, 100, 50);
rect.FillStyle.Color = Color.DeepSkyBlue;
rect.FillStyle.Type = Syncfusion.Windows.Forms.Diagram.FillStyleType.LinearGradient;
rect.FillStyle.ForeColor = Color.White;
diagram1.Model.AppendChild(rect);

[Serializable()]
[TypeConverter(typeof(MyPropertyConverter))]
public class RectangleNode:Rectangle
{
public RectangleNode(float x, float y, float width,float height)
: base(x,y,width,height)
{

}

}
///
/// Serialize helper class for MySymbol.
///

public class MyPropertyConverter : 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)
};

// This code returns only the specified properties. It can be used to filter out
// properties that you do not wish to expose to in property grid.
PropertyDescriptor[] props = new PropertyDescriptor[2];
props[0] = TypeDescriptor.CreateProperty(typeof(Syncfusion.Windows.Forms.Diagram.Rectangle), "Name", typeof(string), attrs);
props[1] = TypeDescriptor.CreateProperty(typeof(Syncfusion.Windows.Forms.Diagram.Rectangle), "EnableCentralPort", typeof(bool), attrs);
return new PropertyDescriptorCollection(props);
}
}
}

Here is the sample:
http://www.syncfusion.com/downloads/Support/DirectTrac/91142/F103286-PropertyEditor-406851996.zip

Please try the above sample and let us know if you have any queries.

Regards,
Amsath Ali. M





Loader.
Live Chat Icon For mobile
Up arrow icon