使用具有用户控件的类型参数的基类

时间:2012-04-26 09:50:02

标签: c# winforms type-parameter

我有一个用户控件,它似乎不喜欢我使用带有类型参数的基类。有没有办法绕过这个/我错过了什么?

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

... Plus the designer code ...

public class PopupSelectionControl3<TValue> : XtraUserControl
{
}

1 个答案:

答案 0 :(得分:0)

WinForms设计人员无法很好地处理通用用户控件。

bernhard rusch提供了一种解决方法here

public partial class UserControl : UserControlDesignable  {  ... } 

public class UserControlDesignable : BaseUserControl<Someclass> { } 

有关变通方法的更多详细信息,请参阅here