I have a user control, GridMasterControl which contains (amongst other things) another control called Grid.
Now I need to inherit from Grid to create EditableGrid (to add editing functionality to the grid).
I then need to create an EditableGridMasterControl which will be identical to GridMasterControl except that it will use EditableGrid, not Grid.
Both ways I can think of to implement this have problems.
1. I could copy and paste GridMasterControl and just change Grid to EditableGrid. Bad idea (code duplication not good).
2. I could get EditableGridMasterControl to inherit from GridMasterControl, then add a virtual function CreateGrid into GridMasterControl. EditableGridMasterControl could implement this to create the EditableGrid control. This too is a very bad idea as I would need to change the designer file to create the control. I need to keep the designer file clean.
How best can I implement this?
EDIT
Just to clarify I think the crux of the problem is that Visual Studio doesnt allow you to modify the designer files it creates (or at least its a very bad idea to) and I want to be able to conditionally create a different class depending on the situation.