duality
duality copied to clipboard
EditorHintCategory-Attribute for Properties
Summary
I think it would be useful, if you could group properties of a single class, especially when you have many properties.
At the moment, the EditorHintCategory-Attribute is only available for classes.
Example:
// This is a Resource File
[EditorHintRange(0, 1000)]
public float Mass { get; set; } = 300f;
public SpaceshipType Type { get; set; } = SpaceshipType.Multipurpose;
[EditorHintCategory("Sound")]
public ContentRef<Sound> AmbientSound = new ContentRef<Sound>();
[EditorHintCategory("Sound")]
public ContentRef<Sound> EngineSound = new ContentRef<Sound>();
The grouped "Sound"-Properties could stored in the "Spoiler"-Like-Control....

What do u think?
Great idea, I think this would be a nice "quality of life" improvement on the editor. A couple of points:
- My personal preference for this would be a specialized way to display categories, with a slightly bolder headline font, proper spacing, no indentation and a default-on foldout arrow that allows to collapse categories as needed (like you suggested). This deserves some work, and we shouldn't just re-use a child editor foldout like your mock screenshot could suggest, so we don't mix up the two things for the user.
- The spot where the property grid evaluates those attributes is here, by gathering the hint attributes and adjusting its generated editor instances.
- For categories, the editor that would need to be extended is the MemberwisePropertyEditor, which is defined in the AdamsLair.WinForms project, so this is where we'd start. Probably some changes required in GroupedPropertyEditor as well. The exact way to go about this is still pretty open and needs investigation.