473,386 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DescriptionAttribute overriding

Hello everybody!

I have a specific problem I haven't been able to answer. I need to show a description of a class in a property grid, but the problem is that I need to show it based on the DescriptionAttribute of that object while at the same time it needs to be converted with an ExpandableObjectConverter. This is my model:

Expand|Select|Wrap|Line Numbers
  1. [DescriptionAttribute("This is a description of this class!")]
  2. public class MyClass
  3. {
  4.     public String MyProperty
  5.     {
  6.         get { return "Some value"; }
  7.     }
  8. }
  9.  
  10. public class MyClassContainer
  11. {
  12.     MyClass _MyClass = new MyClass();
  13.  
  14.     public String MySecondProperty
  15.     {
  16.         get { return "Some other value!; }
  17.     }
  18.  
  19.     [TypeConverter(typeof(ExpandableObjectConverter))]
  20.     public MyClass MyClass
  21.     {
  22.         get { return _MyClass; }
  23.     }
  24. }
  25.  
What this should do is to show the "MySecondProperty" and "MyClass" as properties of the MyClassContainer with the "MyClass" property being expandable, but when clicking on the "MyClass" property there should be a description shown on the bottom of the property grid - the description defined in the MyClass class. For some reason, this doesn't work.. I do know how to access the description dynamically ( I use TypeDescriptor.GetAttributes(value)[typeof(DescriptionAttribute)] ), but don't know how to set it to show!!

Any help would be appreciated!
May 6 '10 #1
0 976

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Andrew Durdin | last post by:
In Python, you can override the behaviour of most operators for a class, by defining __add__, __gt__, and the other special object methods. I noticed that, although there are special methods for...
3
by: Ali Eghtebas | last post by:
Hi, I have 3 questions regarding the code below: 1) Why can't I trap the KEYDOWN while I can trap KEYUP? 2) Is it correct that I use Return True within the IF-Statement? (I've already read...
3
by: David Coleman | last post by:
Hi All, Can anyone tell me how to add the equivalent of DescriptionAttribute for Properties to a public class Method and its passed parameters so it is displayed through intellisense. Have found...
0
by: David Coleman | last post by:
Hello all, I use DescriptionAttribute on Properties in my user controls. Works like a treat. I would like to show Method and Parameters intellisense descriptions in my public class Methods. So...
1
by: Zembaliti | last post by:
The description specified by is displayed in the property browser in the VS.NET Designer. But if the mouse is over the property's text in the VS.NET editor, the tooltip only displays the...
3
by: Brad | last post by:
I've used the Description attribute throughout assembly classes; class; methods; enums, etc. My problem is that the descriptions use to show up in the object browser and now they don't. To...
3
by: Amin Sobati | last post by:
Hi, I have two classes. Class2 inhertis Class1: ----------------------------- Public Class Class1 Public Overridable Sub MySub() End Sub End Class Public Class Class2
0
by: Kamal | last post by:
Really appreciate any help related to this. How do we get the description attribute value. It is not working. Please let me know if anything wrong in this. Thanks for your help. private...
5
by: =?Utf-8?B?U3RldmVU?= | last post by:
I am using in my code. I want to be able to reference a text string within my "Resource file" like this: . The issue is that Description requires a constant string. Is there anyway to...
10
by: r035198x | last post by:
The Object class has five non final methods namely equals, hashCode, toString, clone, and finalize. These were designed to be overridden according to specific general contracts. Other classes that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.