Live Chat Icon For mobile
Live Chat Icon

How do you make your custom data types property browser browsable when contained in a Control/Component (as a property)

Platform: WinForms| Category: Tips
// Your custom data type
public class MySize
{
	...
	public int Width{get{...}set{...}}
	public int Height{get{...}set{...}}
}

public class MySizeConverter: 
	ExpandableObjectConverter
{
	public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
	{
		return true;
	}

	public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
	{
		MySize size = new MySize();
		size.Width = (int)propertyValues[(object)'Width'];
		size.Height = (int)propertyValues[(object)'Height'];
		return (object)size;
	}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.