Setting Custom Property in Property Window for Visual Studio 2010 Layer Diagrams

Posted by shilpa_shree33-13288 under Visual Studio on 1/9/2012 | Points: 10 | Views : 1567 | Status : [Member] | Replies : 0
Hi,

I'm currently new to this Layer Diagram Extensions and with much of googling i found the msdn sample to create Custom Property.Below is the link for the same

http://msdn.microsoft.com/en-us/library/ff657800.aspx

This sample helps to create custom property for "ILayerModel" where "PropertyType" is set to "Boolean".I'm extending the same sample for "ILayer" and instead of "Boolean" type I need Custom Property Type such as enums. But for some reason I'm not able to set the value . I will be able to see the list of Values displayed below my custom Property but upon selection of the indivisual enum from the list, the selection happens but the value is not geting set.

I just wanted to know,

1). If Visual Studio 2010 supports the extensibity to define custom property types, then will it support only system types or if the custom property types are supported then how to set the values for the same and example to do that would be very helpfull??

2) When i set the "propertyType" in one of the overrridng property of "PropertyExtension<ILayer>" to List<string> then it will open the string editor. how to change this behaviour to display a list of values as "Combo Box" ( I dont want the editor to be displayed, but i need the combo box containing the list of values).

The only solution which i found to solve question (2) is by using enums, but when i use enums the problem stated in question (1) occurs. Can you please guide me, how to go about and was unable to find it with much of googling. I'm sure i have missed something. Can any one point out what i have missed.

Below is the reference for question 1.

namespace CreateLayerProperties 
{
[Export(typeof(IPropertyExtension))]
class LayerDiagramProperty : PropertyExtension<ILayer>
{
public static readonly string FullName = typeof(LayerDiagramProperty).FullName;
public LayerDiagramProperty()
: base(FullName)
{
}
public override string DisplayName
{
get
{
return "Custom Layer";
}
}

public override string Description
{
get
{
return base.Description;
}
}

public override void SetValue(object component, object value)
{
ValidateValue(value);
base.SetValue(component, value);
}

private void ValidateValue(object value)
{

}

public override Type PropertyType
{
get
{
return typeof(Trial);
}
}
public override string Category
{
get
{
return "Custom Properties";
}
}
}

public enum Trial
{
A,
B,
C
}

}

Please guide me how to set the value of enum to the PropertyWindow. Should i do any serializations to acheive it.If so how to go about and an example would be greatly appreciated.

Thanks in advance,

Thanks & Regards,
Shilpa Shree



Responses

(No response found.)

Login to post response