I'm trying to figure out the right way to do this.
I have a WinForms app that is using a PropertyGrid as one of the controls; I'm using the .SelectedObject property to assign the appropriate object to display attributes for.
The PropertyGrid uses declared attributes against this object's class properties to determine visual things, e.g. if the item is visible (Browsable), if the attribute requires an alternate UI rendering (e.g. dropdown vs. textbox).
example:
[TypeConverter(typeof(MyTypeConverter))]
public string MyAttribute
{
...
}
[Browsable(false)]
public string HiddenAttribute
{
...
}
However, I don't like the co-mingling of these attributes which are strongly tied to the UI in my otherwise agnostic data classes.
What's the best way of declaring these necessary attributes for the PropertyGrid without sullying up my data classes?