473,651 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PropertyGrid: CategoryAttribu te + BrowsableAttrib utes

Hi All,

I have a form containing only a PropertyGrid that I use to modify an
instance of the following class:

class MyClass
{
Point _point = new Point();

[CategoryAttribu te("Drawing")]
public Point MyPoint
{
get { return _point; }
set { _point = value; }
}
}

All works fine.

Now if I add

this._propertyG rid.BrowsableAt tributes
= new AttributeCollec tion(
new Attribute[] { new CategoryAttribu te("Drawing") });

to the form's initialization code: what happens is that "MyPoint"
property does not more expand in the PropertyGrid.

Is there a way to apply the CategoryAttribu te only to the first level of
properties?

TIA.
Marco.
Oct 12 '07 #1
2 7939
Hello Marco,

I guess that you are trying to show only properties (and their
subproperties) that are under a particular category. Unfortunately you
are not using the right tool to do that. Your subproperties get
filtered because they don't have the CategoryAttribu te you supply. A
better way would be to use a TypeDescriptor or TypeConverter for your
class that would filter out any toplevel property that is not under
the category (it would publish only the PropertyDescrip tors that have
the CategoryAttribu te).

Best regards,

Nicolas Cadilhac @ VisualHint (http://www.visualhint.com)
Home of Smart FieldPackEditor .Net / DateTimePicker replacement (http://
www.visualhint.com/index.php/fieldpackeditor)
Home of Smart PropertyGrid for .Net and MFC (http://www.visualhint.com/
index.php/propertygrid)
Microsoft PropertyGrid Resource List - http://www.propertygridresourcelist.com
On Oct 12, 8:45 am, Marco Segurini <marcosegur...@ gmail.comwrote:
Hi All,

I have a form containing only a PropertyGrid that I use to modify an
instance of the following class:

class MyClass
{
Point _point = new Point();

[CategoryAttribu te("Drawing")]
public Point MyPoint
{
get { return _point; }
set { _point = value; }
}
}

All works fine.

Now if I add

this._propertyG rid.BrowsableAt tributes
= new AttributeCollec tion(
new Attribute[] { new CategoryAttribu te("Drawing") });

to the form's initialization code: what happens is that "MyPoint"
property does not more expand in the PropertyGrid.

Is there a way to apply the CategoryAttribu te only to the first level of
properties?

TIA.
Marco.

Oct 12 '07 #2
Marco,

Unfortunately, no. You would have to apply the appropriate attributes
to your parent class (which I can see you not wanting to do, for obvious
reasons).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Marco Segurini" <ma***********@ gmail.comwrote in message
news:fe******** **@aioe.org...
Hi All,

I have a form containing only a PropertyGrid that I use to modify an
instance of the following class:

class MyClass
{
Point _point = new Point();

[CategoryAttribu te("Drawing")]
public Point MyPoint
{
get { return _point; }
set { _point = value; }
}
}

All works fine.

Now if I add

this._propertyG rid.BrowsableAt tributes
= new AttributeCollec tion(
new Attribute[] { new CategoryAttribu te("Drawing") });

to the form's initialization code: what happens is that "MyPoint" property
does not more expand in the PropertyGrid.

Is there a way to apply the CategoryAttribu te only to the first level of
properties?

TIA.
Marco.

Oct 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7310
by: Nicolas | last post by:
I want to display in my application a PropertyGrid showing only the "Appearance" of a control (ie. textBox) so the user can change it. Bare with me, I'm new in csharp. Where do I go from: this.PropertyGrid1.SelectedObject = this.Textbox1; Thank a lot
2
3972
by: Mevar81 | last post by:
Hi to everybody.I have a problem with the PropertyGrid control.I want to display not all the properties of a generic Control(Button,TextBox,ComboBox,ecc.).In general I don't want to display only one category(Appearance, Behavior,ecc.) but I want to chose directly which properties to show.I've read that I can use the SelectedObjects to put an array of object with some properties in common with the SelectedObject,and only properties in...
1
24656
by: Daniel | last post by:
How do I use a combobox in a propertygrid without using enum ? Any suggestions?
4
3070
by: Bernie Yaeger | last post by:
How can I set the browsableattributes of the control that has been selected (selectedobject) by the propertygrid? Here's what I'm after - I want to open a form with a propertygrid in it. The selectedobject will be the form itself. I want the user to change certain properties, thus changing the form. This works fine, but what I really want is to take the changes and lock them into a config file, such that this pc will then display all...
0
1360
by: tg.foobar | last post by:
i'm using a propertygrid to show / edit values of a class that i have. I'm using the new(er) nullable types and it's showing the value of these items as empty (as i would think), but the propertygrid doesn't seem to associate the proper editing control. for example: i have: DateTime? _actualReceivedDate; .....
0
864
by: Massimo | last post by:
I'm creating a class for propertygrid, but I have a question about CaregoryAttribute, DisplayName and DescriptionAttribute: CategoryAttribute("Language") DisplayName("Language") DescriptionAttribute("Select application language")
2
2353
by: =?Utf-8?B?Sm9obiBPbGJlcnQ=?= | last post by:
I am trying to set the PropertyGrid. BrowsableAttributes to multiple values of CategoryAttribute but if I use more then one no properties are displayed. Code below-- Attribute filterattribute1=new CategoryAttribute("TestJ1"); Attribute filterattribute2=new CategoryAttribute("TestJ2"); propertyGrid1.BrowsableAttributes=new AttributeCollection(new Attribute { new CategoryAttribute("Appearance"), new CategoryAttribute("Layout")});...
3
5121
by: michelqa | last post by:
Hi, I have a form with a control..(a button for example). Then the control properties are displayed in a propertyGrid control. Is there any simple way to remove some unwanted properties from the propertyGrid....removing the "AccessibleName" properties by example? Any example about how to play with the PropertyDescriptorCollection to remove some properties??
0
1206
by: sandeepkavade | last post by:
Hi, I am basically a VC++ developer but now working on C#. I am having a assembly in that i have added a UserControl and on that UserControl I am having a tree-view control and Property Grid control. As and when user selects the different nodes I am populating the corresponding properties in that grid. For the normal properties its working perfectly. But when I have to choose the property from the drop-down list. Its creating the problem....
0
8352
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8697
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8579
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4283
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2699
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1909
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1587
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.