I have used the type converter class EnumDescClass from CodeProject to associate a descriptive text with some enum values.
This is my enum definition:
I have previously used this technique with the Windows Forms PropertyGrid control, but not in WPF.
It seems to work so long as I don't actually change the value of the property. If I do, it throws an exception in the method DescriptorPropertyDefinitionBase.UpdateAdvanceOptionsForItem() at the line
"Constructor on type 'Jcl.Util.EnumDescConverter' not found."
I can't figure this out. I'm not really an expert on type convertors or on WPF.
The class EnumDescConverter does have a constructor, which is public and requires a parameter of System.Type. It does not have a parameterless constructor, but I think this would be inappropriate for a type converter.
Can anyone explain the error, or alternatively suggest an alternative to the EnumDescConverter class to get a descriptive text for enum values in the PropertyGrid?
Thanks in advance
Phil
This is my enum definition:
[TypeConverter(typeof(EnumDescConverter))]
public enum OuterFaceMethod
{
[Description("Rounded - Inward pointing corners rounded on outer face of cutter")]
Rounded = 0,
[Description("Stripes - Triangulation in multiple stripes")]
Stripes = 1
}
I am trying to use the PropertyGrid to display a property of this enum type.I have previously used this technique with the Windows Forms PropertyGrid control, but not in WPF.
It seems to work so long as I don't actually change the value of the property. If I do, it throws an exception in the method DescriptorPropertyDefinitionBase.UpdateAdvanceOptionsForItem() at the line
isResource = ( markupProperty.Value is Style );
The exception is System.MissingMethodException with the description:"Constructor on type 'Jcl.Util.EnumDescConverter' not found."
I can't figure this out. I'm not really an expert on type convertors or on WPF.
The class EnumDescConverter does have a constructor, which is public and requires a parameter of System.Type. It does not have a parameterless constructor, but I think this would be inappropriate for a type converter.
Can anyone explain the error, or alternatively suggest an alternative to the EnumDescConverter class to get a descriptive text for enum values in the PropertyGrid?
Thanks in advance
Phil