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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custome Property Editor

Thread ID:

Created:

Updated:

Platform:

Replies:

58001 Mar 15,2007 04:26 PM UTC Mar 15,2007 06:15 PM UTC Windows Forms 1
loading
Tags: Diagram
Administrator [Syncfusion]
Asked On March 15, 2007 04:26 PM UTC

Hi, is it possible to show the node properties in the property edit window.i have two collection as shown in the code, both are IList. Is it possible to show them in the property window.

public class Node : Symbol
{

private IList NodeParameterCollection; ///1
private IList Collection=null; ///2
}

Thank you.
Regards,

J.Nagarajan [Syncfusion]
Replied On March 15, 2007 06:15 PM UTC

Hi Ali,

Yes you can show the node's properties that you wish to expose to in property grid. You can use PropertyDescriptorCollection class to achieve this. Please refer to the following code snippet

public class MySymbolConverter : System.ComponentModel.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)
{
System.Attribute[] attrs = new System.Attribute[]
{
new System.ComponentModel.BrowsableAttribute(true)
};

PropertyDescriptor[] props = new PropertyDescriptor[4];
props[0] = TypeDescriptor.CreateProperty(typeof(MySymbol), "Name", typeof(string), attrs);
props[1] = TypeDescriptor.CreateProperty(typeof(MySymbol), "ClickCount", typeof(int), attrs);
props[2] = TypeDescriptor.CreateProperty(typeof(MySymbol), "Labels", typeof(LabelCollection), attrs);
props[3] = TypeDescriptor.CreateProperty(typeof(MySymbol), "DefaultLabelName", typeof(string), attrs);
return new PropertyDescriptorCollection(props);

// This code returns all browsable properties
return TypeDescriptor.GetProperties(value, attrs);

}
}

Also refer to our Custom Symbol sample( \\Windows\Diagram.Windows\Samples\Symbol Design\CustomSymbol) that demonstrates this completely.

Let me know if you have any questions.

Regards,
Nagaraj

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

;