Solved

Notify designer that property has changed type

Posted on 2003-10-28
2
446 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now