Using the PropertyGrid control

Using the PropertyGrid control

stefanome
Collaborator Collaborator
837 Views
5 Replies
Message 1 of 6

Using the PropertyGrid control

stefanome
Collaborator
Collaborator

I want to use the PropertyGrid control on a main Settings form to allow the user to configure the add-in and on a few dedicated forms to manage some details of the project. The list of valid settings and their default values are loaded from a json file the first time the Settings form is opened, then stored in a DataStorage.

 

The documentation gives you some guidelines about how to use the property grid, but doesn't mention any helper functions.

 

I was hoping to find a standard property grid, a few helper classes for the common types, like length, angle, material, etc., and I could cycle through my json settings, create one object using one of those classes according to the setting description in the json data and add them one by one to the property grid. Well, I'm posted this because I didn't find the helper classes or any description of how to use the property grid.

 

Does it mean that I need to create my own form with my own PropertyGrid control?

And I need to create all the classes required for that thing to work?

Classes that are already complex enough for predefined classes, but reach nightmare level for dynamic classes?

 

Please someone tell me that there is an easier way!

0 Likes
Accepted solutions (1)
838 Views
5 Replies
Replies (5)
Message 2 of 6

RPTHOMAS108
Mentor
Mentor
Accepted solution

Not come across anything in API that would be helpful to use in that respect. The majority if not all of add-in UI development in down to developer (probably considering Forge that will not change).

 

I don't think PropertyGrid control was incorporated from Forms to WPF.

In Forms it doesn't appear to have any DataBinding support, which is odd.

 

With WPF I would probably go down the DataGrid route. You may find custom controls that mimic PropertyGrid such as WPF Property Grid - CodePlex Archive.

0 Likes
Message 3 of 6

reylorente1
Collaborator
Collaborator

No se si realmente es lo que quieres,pero te doy este pequeño script.Espero que te ayude.

 

I don't know if it really is what you want, but I give you this little script. Hope it helps you

 

0 Likes
Message 4 of 6

stefanome
Collaborator
Collaborator

Thanks for the example, but it looks like the PropertyGrid control is used to show properties of Revit objects, not of dynamically generated data structure. Here is the only use of the SelectedObject property, which uses a Room

 

Room habitacion = elem as Room;
// Rellenar las propiedades
this.prpProperty.SelectedObject = habitacion;

 

0 Likes
Message 5 of 6

stefanome
Collaborator
Collaborator

I played with it for one week and I decided that I don't want to waste any more time on it.

I will keep the PropertyGrid only for Revit classes and create my own form for dynamic data structures.

0 Likes
Message 6 of 6

reylorente1
Collaborator
Collaborator

not of dynamically generated data structure.

You also need to show, for example, door, window, etc. Sorry, my English is poor

Tambien necesitas mostrar ,por ejemplos,puerta ,ventana,etc.Disculpas,mi ingles es pobre 

0 Likes