Solved

Notify designer that property has changed type

Posted on 2003-10-28
2
448 Views
Last Modified: 2013-12-03
I have two classes that use ExpandableObjectConverters to provide properties for controls that expose them as properties.  Lets call these PropertyClassA and PropertyClassB.  If I expose a property as a generic Object call it MyProperties() and return a PropertyClassA the Property grid of the designer will let me see the properties of PropertyClassA.  If I have another property that changes the value that is returned by MyProperties() to a PropertyClassB how do I notify the designer that my property types of changed so that it can refresh its display?

That sounds like a mouthfull and I like examples.  When I toggle the 'TypeA' property of MyCustomControl below the property grid does not reflect the change.  And yes this is a very convoluted example ;-)


<TypeConverter(GetType(ExpandableObjectConverter))> _
public class PropertyClassA
      public property Name as string ...
      public property ClassAValue as string ...
end class

<TypeConverter(GetType(ExpandableObjectConverter))> _
public class PropertyClassB
      public property Name as string ...
      public property ClassBValue as integer ...
end class

public class MyCustomControl
      inherits UserControl
      private myProperties as Object = new PropertyClassA
      public writeonly property TypeA as Boolean
           Set(value as boolean)
                if value then
                   myProperties = new PropertyClassA
                else
                   myProperties = new PropertyClassB
                end if
           End If
      End property
      public property MultiTypeProperties as Object ...
end class
     
0
Comment
Question by:bacon7181
2 Comments
 
LVL 3

Accepted Solution

by:
bacon7181 earned 0 total points
ID: 9645277
Once again I answer my own question,  I am the man.

<RefreshProperties(RefreshProperties.All)> _
     public writeonly property TypeA as Boolean
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question