Property Grid Question.

  • Thread starter Thread starter pnp
  • Start date Start date
P

pnp

When I use a custom class object as the selected object of a property gird
control is there a way to set custom names fro the grouped sections shown in
it?

Thanks,
Peter
 
When you define the property in your class.. you can specify designer
attributes in square brackets [] immediately above the property definition.
The attribute you want is "Category".
e.g.
[Category("SpecialCategory"), Browsable(true), DefaultValue(88),
MergableProperty(true),
RefreshProperties(System.ComponentModel.RefreshProperties.All),
Description("Width of the Label")]

public int LabelWidth
{ get { return label.Width;}set {label.Width =value;textBox.Width =
this.Width - value;}

(example is from a custom contrl that contains a label plus a textbox.)

-Rachel

----- Original Message -----
From: "pnp" <pnp.at.softlab.ece.ntua.gr>
Newsgroups: microsoft.public.dotnet.languages.csharp
Sent: Monday, August 23, 2004 9:25 AM
Subject: Property Grid Question.
 
Use Category attribute for that property.

"pnp" <pnp.at.softlab.ece.ntua.gr> wrote in message
When I use a custom class object as the selected object of a property gird
control is there a way to set custom names fro the grouped sections shown in
it?

Thanks,
Peter
 
Thanks you Rachel.
Peter

Rachel Suddeth said:
When you define the property in your class.. you can specify designer
attributes in square brackets [] immediately above the property definition.
The attribute you want is "Category".
e.g.
[Category("SpecialCategory"), Browsable(true), DefaultValue(88),
MergableProperty(true),
RefreshProperties(System.ComponentModel.RefreshProperties.All),
Description("Width of the Label")]

public int LabelWidth
{ get { return label.Width;}set {label.Width =value;textBox.Width =
this.Width - value;}

(example is from a custom contrl that contains a label plus a textbox.)

-Rachel

----- Original Message -----
From: "pnp" <pnp.at.softlab.ece.ntua.gr>
Newsgroups: microsoft.public.dotnet.languages.csharp
Sent: Monday, August 23, 2004 9:25 AM
Subject: Property Grid Question.

When I use a custom class object as the selected object of a property gird
control is there a way to set custom names fro the grouped sections
shown
in
it?

Thanks,
Peter

pnp said:
When I use a custom class object as the selected object of a property gird
control is there a way to set custom names fro the grouped sections
shown
in
it?

Thanks,
Peter
 
Back
Top