为什么我的CheckedListBoxEdit不绑定到项目列表?

时间:2019-01-24 06:19:43

标签: data-binding devexpress

在以下代码中:

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";

checkedComboServicePointsCheckedComboBoxEdit,而checkedListServicePointsCheckedListBoxEditCheckedComboBoxEdit可以很好地绑定,我可以在下拉列表中看到绑定的项目,但是我的checkedListServicePoints在运行时总是出现空白方块。我相信我满足了我发现的here的DexExpress论坛答案中的所有要求,为什么我的CheckedListBoxEdit没有绑定?

我的代码中都有两个绑定目标,因为一个可以工作,而第二个不工作将替代第一个。

1 个答案:

答案 0 :(得分:0)

尝试一下

container.checkedListServicePoints.DataSource = allPharmacyServicePoints.ToList;
container.checkedListServicePoints.ValueMember = "UnitOrCellId";
container.checkedListServicePoints.DisplayMember = "Name";
container.checkedListServicePoints.SelectedValue = "UnitOrCellId";