Solved

Notify designer that property has changed type

Posted on 2003-10-28
2
449 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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