在以下代码中:
container.checkedComboServicePoints.Properties.DataSource = allPharmacyServicePoints;
container.checkedComboServicePoints.Properties.ValueMember = "UnitOrCellId";
container.checkedComboServicePoints.Properties.DisplayMember = "Name";
container.checkedComboServicePoints.Properties.EditValueType = EditValueTypeCollection.List;
container.checkedListServicePoints.DataSource = allPharmacyServicePoints;
container.checkedListServicePoints.ValueMember = "UnitOrCellId";
container.checkedListServicePoints.DisplayMember = "Name";
checkedComboServicePoints
是CheckedComboBoxEdit
,而checkedListServicePoints
是CheckedListBoxEdit
。 CheckedComboBoxEdit
可以很好地绑定,我可以在下拉列表中看到绑定的项目,但是我的checkedListServicePoints
在运行时总是出现空白方块。我相信我满足了我发现的here的DexExpress论坛答案中的所有要求,为什么我的CheckedListBoxEdit
没有绑定?
我的代码中都有两个绑定目标,因为一个可以工作,而第二个不工作将替代第一个。
答案 0 :(得分:0)
尝试一下
container.checkedListServicePoints.DataSource = allPharmacyServicePoints.ToList;
container.checkedListServicePoints.ValueMember = "UnitOrCellId";
container.checkedListServicePoints.DisplayMember = "Name";
container.checkedListServicePoints.SelectedValue = "UnitOrCellId";