PropertyGrid

  • Thread starter Thread starter Zoury
  • Start date Start date
Z

Zoury

Hi!

Is it possible to use the PropertyGrid control without bind it to a control?
As if it were a standard list?

I would like to add "properties" in it but i never know what it will be. For
now I use a DataGrid with 2 columns in it where the first one as the
ReadOnly property property set to true.. it's quite ugly.

if it's impossible then i'm open to any suggestions. :O)

thanks all and have a nice weekend!
 
Zoury said:
Hi!

Is it possible to use the PropertyGrid control without bind it to a
control? As if it were a standard list?

I would like to add "properties" in it but i never know what it will
be. For now I use a DataGrid with 2 columns in it where the first one
as the ReadOnly property property set to true.. it's quite ugly.

if it's impossible then i'm open to any suggestions. :O)

Can you please be more speciffic? I did not understand what you are
trying to achieve. What I can say and hope it helps is that, as far as
I know, the DataGrid can be filled only by binding it to a control, but
this approach is very flexible. You can bind it to an Array built at
runtime, etc.
 
Hi Christina! :O)

Sorry if it wasn't clear.

I would like to use the PropertyGrid control or something similar to it.
For what i've seen so far this control can be bind to an object using the
SelectedObject property. Doing so fills the PropertyGrid with the public
properties and values of the given object.

I was wondering if there is a way I could fill the PropertyGrid without
using the SelectedObject property. I would like to do something like the
following (note the following syntax doesn't exists.. it's just given as an
example) :

//
// let's say the Add method has the following declaration :
// Property Add(string Name, Type Type, object DefaultValue)
//
PropertyGrid1.Properties.Add("LastName", typeof(string), "Lefebvre");
PropertyGrid1.Properties.Add("FirstName", typeof(string), "Yanick");
PropertyGrid1.Properties.Add("DOB", typeof(string), new DateTime(1980, 9,
6));

I hope it's clearer now. ;O)
 
Doh! clicked send just a hair too soon.
See the
System.ComponentModel.ICustomTypeDescriptor class.

That should be ICustomTypeDescriptor interface, not class.

Jay
 
Back
Top