Solved

Notify designer that property has changed type

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 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