Creating custom controls with generics
We want to create a custom WinForms control (which is derived from a .net control) and be able to drag it out of the tool window in the designer view. However, we cannot do this when we have a generic control, because when a designer tries to instantiate a class, for obvious reasons he doesn't know what type the instance should be.
Does anyone know about this?
Thank you in advance
====== edit ===========
What we would like to do is an example:
public class MyDataGridView<T> : DataGridView where T : class{
...
}
by removing the generics, we can see the preview in the designer as if it were a regular DataGridView, but as I explained above with generics, we cannot use the constructor.
+3
source to share