解决DevExpress的RepositoryItemCheckEdit类型的多选框不能多选问题
(2010-11-19 14:14:13)
标签:
杂谈 |
分类: Windows Form |
最近一直在弄第三方控件DevExpress,在gridcontol中嵌套进复选框,却只能单选,为了解决此问题在网上查了相关资料,并结合项目情况,最终得以解决
1.
ICE_selectedMark.QueryCheckStateByValue += new DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventHandler(ICE_selectedMark_QueryCheckStateByValue);
2.
/// <summary>
/// 处理 RepositoryItemCheckEdit 类型的选择框多选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ICE_selectedMark_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventArgs
e)
{
string val = "";
if (e.Value != null)
{
val = e.Value.ToString();
}
else
{
val = "True"; //默认为选中
}
switch (val)
{
case "True":
case "Yes":
case "1":
e.CheckState = CheckState.Checked;
break;
case "False":
case "No":
case "0":
e.CheckState = CheckState.Unchecked;
break;
default:
e.CheckState = CheckState.Unchecked;
break;
}
e.Handled = true;
}
1.
ICE_selectedMark.QueryCheckStateByValue += new DevExpress.XtraEditors.Controls.QueryCheckStateByValueEv
2.
/// <summary>
/// 处理 RepositoryItemCheckEdit 类型的选择框多选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ICE_selectedMark_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEv
{
string val = "";
if (e.Value != null)
{
val = e.Value.ToString();
}
else
{
val = "True"; //默认为选中
}
switch (val)
{
case "True":
case "Yes":
case "1":
e.CheckState = CheckState.Checked;
break;
case "False":
case "No":
case "0":
e.CheckState = CheckState.Unchecked;
break;
default:
e.CheckState = CheckState.Unchecked;
break;
}
e.Handled = true;
}

加载中…