picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.67k stars 333 forks source link

Create an interface for controls to show that they can hide the border #2433

Closed Miepee closed 1 year ago

Miepee commented 1 year ago

This PR creates a new interface (IHideControlBorder) which defines whether controls can show/hide the controls around their borders. This makes it possible to later get rid of duplicated documentation text, and also make it easier to figure out whether (custom) controls support that feature. For example, when one wants to disable the borders for all possible controls that are in a grid view, one could just do something akin to

foreach (var control in GetGridViewItems())
{
    if ((control as IHideControlBorder) is not null)
        (control as IHideControlBorder).ShowBorder = false;
}
cwensley commented 1 year ago

Hey @Miepee, I'm not really a fan of adding interfaces for common properties on controls. Is this really necessary? This adds a lot of code smell in my opinion. There are also other common properties/functionality that could have specific interfaces.. I'm not sure where it would end nor do I want to see a bunch of these added.

Miepee commented 1 year ago

My main concern was, that it's currently a bit difficult to know for which controls to disable ShowBorders. I guess a slower workaround would be to just use reflection. Also, and this may just be me, but I personally find having copypasted documentation harder to maintain, because you don't always remember that a specific text was also used 5 times somewhere else.

Making an interface for a single control is probably a bad idea tho. If you've got any alternative ideas, I'd be open to them.

cwensley commented 1 year ago

Closing this as I don't think adding interfaces for controls with common properties is a thing we want to implement. I really appreciate the thought and effort that went into this. I'm open to other ideas but right now this isn't where I want to go with the framework.