Solved

Notify designer that property has changed type

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ASP.net VB.net hide footer cells of GridView 2 32
Set form below another form 3 26
Showdialog 8 20
Saveas need to save a copy 16 11
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

21 Experts available now in Live!

Get 1:1 Help Now