There has been a lot of discussion over the pain of using the DataGrid in .NET 1.x. This pain and the endless sample work-around code to accomplish desired behaviors prompted Microsoft to release the GridView control in .NET 2.0. One control that I would like to add the list of "looks nice but is a pain to work with" is the PropertyGrid. It looks really nice and could have a mess of highly useful functionality in a UI, but you just have to glean so much knowledge from disparate and incomplete sources or build in so much customization that feels like a hack, that I would add my vote to this being one control that deserves rework.
This was all prompted by my showing a coworker some attributes I added to one of our application’s custom controls to enable design-time control over the property and behavior of the control. All custom controls display their properties in the VS IDE within the context of a property grid (I mean, what else would you call it when you right click a control and select ‘Properties’?!?). So, I added some attributes to the property to get it to behave, at design time, the way I wanted it to. I was asked how I knew what attributes I could put on it to make it work properly. The answer is that I had the experience (read "pain") of working with a property grid on another project where I did some research into the PropertyGrid control that came into play.
For anyone interested, here’s a few links that I use when dealing with the PropertyGrid control. My advice would be to stay away (ever notice that properties displayed in the PropertyGrid don’t contain spaces? Yeah, that’s a limitation of using reflection to glean a property name and not providing an attribute capable of overriding that behavior… how irritating!)
- Getting the Most Out of the .NET Framework PropertyGrid Control
- User Interface Type Editors Overview
- Make Your Components Really RAD with VIsual Studio .NET Property Browser
- Bending .NET PRoperetyGrid to your will with a custom Type Editor
- There was also a good article out there on creating a custom attribute to set the order the properties displayed in the grid, but I can’t find that link at the moment. I’ll post it if I come across it again.
Consider this your warning… run… run far away!