在运行时将Devexpress ListBoxControl转换为CheckedListbox / Radio Group Control

时间:2012-03-07 11:36:18

标签: winforms devexpress xtraeditors

我有很多遗留代码,我正在尝试修改很少的行,以便获得所需的功能。我的问题是:

我有一个DevExpress.XtraEditors.ListBoxControl。现在有一个'initFunction'在运行时填充此ListBoxControl。 initFunction()最初是这样的:

initFunction()
{
//code to populate and initialize ListBoxControl
abc = new DevExpress.XtraEditors.ListBoxControl(); //abc is declared as ListBoxControl
}//end of initFunction

usual ListBoxControl

我必须修改该功能,使它看起来像这样:

initFunction(bool allowMultipleSelect)
{
if(allowMultipleSelect)
{
//initialize the ListBoxControl as a CheckedListBoxControl 

}
if(!allowMultipleSelect)
{
/*initialize the ListBoxControl as Radio Group Control so that only one value can be selected from the list */

}


}//end of initFunction

enter image description here

现在,我该如何继续这样做?我尝试在ListBoxControl中查找属性,这将允许我有选择地将控件初始化为已检查/无线电控件,但找不到任何属性。

也无法将ListBoxControl初始化为CheckedListBoxControl / Radio Control。那么有什么建议吗?

1 个答案:

答案 0 :(得分:0)

好的,没有简单的方法可以实现这一目标。涉及很多代码。这是一个以不那么优雅的方式回答此查询的链接: E3152