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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PropertyEditor disabled properties

Thread ID:

Created:

Updated:

Platform:

Replies:

103286 Apr 19,2012 09:26 AM UTC Apr 25,2012 07:29 AM UTC WinForms 1
loading
Tags: Diagram
Blanca Calderon
Asked On April 19, 2012 09:26 AM UTC

Hi,

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

Thanks in advanced,

Blanca




Amsath Ali M [Syncfusion]
Replied On 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





CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;