[quoted text, click to view] "Marc Gravell" <marc.gravell@gmail.com> wrote in message
news:01421bbf-b87c-453c-8052-615d99e6769f@u69g2000hse.googlegroups.com...
> Sorry for delay... weekend etc...
>
> I've answered the default thing on your other thread.
>
> Re the usage; you would normally give the object itself to the
> PropertyGrid, although a facade is fine too...
>
> Basically, PropertyGrid gets its values by calling
> TypeDescriptor.GetProperties(yourObject);
>
> You can influence what TypeDescriptor returns in two ways; if your
> object itself implements ICustomTypeDescriptor, then it will use this;
> this approach is useful if the properties change instance-by-instance
> (such as with a DataTable / DataRowView). Alternatively; if the
> properties are the same for all instances of the type, you can move
> this out of the type by using a TypeDescriptionProvider and
> associating that with the type (either through an attribute or a
> call). For example, in one of my systems the "extended" values (key/
> value pairs) are the same per type - i.e. every Customer has the same
> set of extended values - so I use TypeDescriptionProvider.
>
> What you have done is provide a "facade" - i.e. a *separate* object
> that you give the grid instead of your actual object. This is also a
> valid choice, but it might be harder to bind to some other controls.
>
> If you can describe the setup a bit more I can probably knock up a
> pretty complete example in either instance/type syntax...
>
> Marc
thanks very much for your help, its been a bit confusing but
ive learned enough to get it to do what I want :)
I just need to add implemention for fields wich are themselves user defined
structs,
such as vectors wich are 3 floats x,y,z.
ive seen references as to how to do this.
basically the classes are not c# but a custom script language,
the non defualt fields are stored in the file
and theres a definition of the class in the file
and the user can create new classes.
I just store the field data in a dictionary for each object
and a similar dictionary for the field definitions.
the propertygrid seemed better than using a data grid,
especially as there are already catagory definitions.
the files are part of a 3d game, i was hoping to not clutter up the
objects classes so they look close to the definitions.
I also need to edit a large amount of complicated data,
and I find the data grid very slow for large data sets.
maybe one day il make my own cell based data editor.
Colin =^.^=