Making Properties editable in the Properties Window
Hello everyone,
I created a new GameComponent which has a XNA.Framework.Rectangle as a property. I added one of these objects to my Game instance, but can't edit the Rectangle property (it is grayed out). How can I write a property (or class) in a way that would make it editable in the Property Window?
One solution I found was to make a number of Int properties that redirect to be member variables of the Rectangle. This is a bit clunky, though. I would like to be able to expand and edit the Rectangle property instead.
It is not specifically Rectangle that I am interested in, as I would also like to make classes that I have created be able to be edited as properties as well. Does anyone know how I can do this? Are there any tutorials out there?
thanks!
edited - changed GameObject to correctly say GameComponent
[831 byte] By [
azound] at [2007-12-25]
I may be wrong but I don't think reference types will show up in the Properties window as editable, just value types and possibly the built in types, such as System.String.
I believe Reference types can show up. In the XNA Components demo video based on the GameFest talk, they showed creating an object that had a reference to another object, and then in the designer, created the referenced and referencing object, and hooked up the reference between the two using the Properties window.
Anyone know how to do this? If I could do this in my app (ie, create a Rectangle in the design view and reference it in my object), that would essentially do what I would like.
If you're talking about one component on the gamecomponent referencing another, that's probably a different story than the Rectangle you're trying to use because the objects have been instantiated. Not so with your rectangle. Again, I may be wrong (it's happened once or twice in my life.

).
I believe this is coming - see the empty Microsoft.XNA.Framework.Design namespace....
In the meantime i've been using the System.Drawing designers instead and just converting the objects back to XNA ones...