• Advertisement
Sign in to follow this  

[.net] Tying a TextBox to instance.Property for automatic update

This topic is 3550 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Still new to all this so ... sorry for my ignorance. Hey it's great that the property grid automatically retrieves and stores the property data for an instance. This works great for me and other programmers. Artists, on the other hand, want instances to be presented with a nice UI. As such, I was wondering if there is anything in the .NET toolset that can slave a texbox to a property on an instance? I'm trying to find out if I need to roll my own, or not, as I will have to integrate it with the undo/redo/scriptable behaviour. PS. Also, how does range validation work for property grids? PPS. Anyone have any good open-source UI framework for C#? We are discussing releasing our application source code but the UI framework we have isn't free. It supports toolbars with customization, the Office2007 ribbon and dockable panels.

Share this post


Link to post
Share on other sites
Advertisement
Assuming you're working in the Visual Studio environment you can attach attributes to your properties to help the PropertyGrid determine how to display and edit them.

MSDN Magazine has a nice writeup of design time functionality at http://msdn.microsoft.com/en-us/magazine/cc164048.aspx. While the controls and such have changed, the basic attributes and usage have not.

If you're looking for another type of link you'll have to roll your own. Your best bet is to follow a setup similar to the above: create an attribute, use reflection within the editing application to determine the attribute on each property, and bring up the appropriate editor for it.

If you need samples of code to use for reflecting the object type and determining the attributes applied I can provide; just let me know.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement