For a customer, Delaware consulting was requested to create a fields panel that would show some fields, but would hide other fields (If you want I can provide the reason why).
To do that, I hoped to extend the FieldsPanel with a property "HiddenFields". I created a class CustomFieldsPanel and overwrote OnInit to change the property CategoriesGenerator of the panel's FieldGridView. To make the HiddenFields property configurable via xml, I also overwrote the Read method.
Unfortuneatly, all PIMS panels inherit UserControl. Making it impossible for me to inherit FieldsPanel (or any other panel).
I still needed the HiddenFields property on the panel, so I opened up DotPeek and started copying all code from the FieldsPanel in to my own CustomFieldsPanel class.
Although this works perfectly, as a partner developer, I wasted a lot of time copy pasting from DotPeek. Obfuscating the code of your dll also doesn't help. Not only that, but if at some point you find a bug in the FieldPanel or add some feature or ... I have to go back to DotPeek and search for whatever code you added or removed an copy the behavior back into my code.
To make matters worse, the FieldsPanel uses the internal class BinderControlHelper. So I ended up copying that class as well.
Another example of overriding a panel is the ProductClassificationsPanel. All I wanted to do was not show the "Manage classifications..." button. But ended up copying a class of 300+ lines of code. Copying other panels was also considered, but we didn't do it because of the copy/paste risk. Instead we created simpler controls using and overriding Adam.Web controls.
I had the same problem when creating a custom ViewControl. Since I started creating the custom ViewControl in PIMS 3.x and had to upgrade to Products 4, I had to write the class twice because the styling and the HTML of a ViewControl was completly changed.
To finish here's my feature request. I would like to see all PIMS panels inherit Control instead of UserControl. In addition to that, I would also like you to do the same for ViewControl (inheriting from Control instead of UserControl).
That way partners can override existing panels and add small features. This would lower the cost of custom code, making ADAM customers very happy.
Customer support service by UserEcho