简体   繁体   中英

Using a base class with a type parameter for a User Control

I have a user control and it does not seem to like me using a base class with a type parameter. Is there any way around this/am I missing something?

public partial class PopupSelector : PopupSelectionControl3<int>
{
    public PopupSelector()
    {
        InitializeComponent();
    }
}

... Plus the designer code ...

public class PopupSelectionControl3<TValue> : XtraUserControl
{
}

The WinForms designer does not cope very well with generic UserControls.

bernhardrusch provides a workaround here

public partial class UserControl : UserControlDesignable  {  ... } 

public class UserControlDesignable : BaseUserControl<Someclass> { } 

More detail on the workaround can be found here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM