Designer Support?
dazinator opened this issue · 4 comments
This is due to a limitation in the way that WinForms works. It does not support generic classes that inherit from Form
. A work-around is to create a dummy class that inherits from the generic View class. This must be in a separate file:
Dummy:
public class DialogForIPresentSampleDialog : Dialog<IPresentSampleDialog> {}
Dialog:
public partial class SampleDialog : DialogForIPresentSampleDialog, ISampleDialogView
{
public SampleDialog()
{
InitializeComponent();
}
}
@derfsplat think this warrants a Readme update?
Hi Darrell, Eric's right- it's a bug in the winforms designer MS is not going to fix. The workaround does work, however it's not something I can bake into the framework since you have to be able to specify the T
of your presenter on the view to get some of the magic to work.
Open to any bright ideas 😄 .
I'll update the readme in the meantime and provide a sample.
Ok - I thought that would probably be the case :)
Before looking at this framework, I also came accross https://winformsmvp.codeplex.com/ which has the same limitation with the designer, and they have a couple of suggested workarounds. I think they do offer some non generic base classes if I have remembered correctly.
Readme Complete - https://github.com/derfsplat/MiniMVP#designer-support-when-inheriting-generic-view-classes. Also added to samples.