Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am trying to use a custom TypeDescriptionProvider to the partial Settings class file that goes with generated partial class by the Settings designer, and it does not appear to work.

Thanks,
daniel

My partial class looks like this:
[TypeDescriptionProvider(typeof(SettingsTypeDescriptionProvider))]
internal sealed partial class Settings {
public Settings() {
}


My custom type description provider:

internal class SettingsTypeDescriptionProvider : TypeDescriptionProvider
{
  private static TypeDescriptionProvider
  defaultTypeProvider = TypeDescriptor.GetProvider(typeof(Settings));

  public SettingsTypeDescriptionProvider()
   : base(defaultTypeProvider)
  {
          
  }

   
  public override ICustomTypeDescriptor GetTypeDescriptor(System.Type objectType, object instance)
  {
    ICustomTypeDescriptor defaultDescriptor =  base.GetTypeDescriptor(objectType, instance);
    return instance == null ? defaultDescriptor : 
    new SettingsCustomTypeDescriptor(defaultDescriptor, instance);
  }
}
Posted
Updated 19-Apr-11 5:18am
v2
Comments
walterhevedeich 19-Apr-11 21:20pm    
why do you say it doesnt work and what error do you encounter?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900