0

嗨,我在 winform 上使用 devExpress。我有一个项目列表 wholeList = {Item1,Item2,Item3,Item4,Item5,Item6},我还有另外两个列表:ActionAList = {Item1,Item3,Item5},ActionBList = {Item2,Item4,Item6}。我的表单上有一个网格视图。我在这个网格上有两列“Action”和“Item”。每列都有一个 repositoryItemComboBox 作为就地编辑器。

在“Action”的下拉列表中,我有“ActionA”和“ActionB”。在“项目”的下拉列表中,我有所有 6 个项目 Item1 到 Item6。当我选择 ActionA 时,我希望 Item 下拉列表仅显示 Item1、Item3 和 Item5。当我选择 ActionB 时,我希望 Item 下拉列表只显示 Item2、Item4 和 Item6。

我认为当用户选择不同的操作(A 或 B)时,我可以清除 Item 下拉列表中的 repositoryItems,并将 ActionAList 或 ActionBList 添加回 repositoryItem。但是我觉得不舒服,因为有可能此时Item下拉菜单中的可用项目只有Item1,3和5,但另一行可能仍然保留ActionB和Item2。

我想知道归档此要求的最佳方法是什么。我也想我们是否有什么方法可以隐藏整个列表中的一些项目。因此,当用户打开 Item 下拉列表的编辑器时。根据当前行的action值,我可能只在ActionAList或ActionBList中显示项目。但是当我创建 ComboBoxItem 或 ImageComboBoxItem 时,我无法找到这样的属性。

感谢您的任何意见!

4

1 回答 1

0

Firstly, please remember that repositoryItems are only templates to construct editors for each row in GridView. The only way to control editors on cell basis is handling CustomRowCellEdit event (where you can choose existing editor or create custom editor).

Secondly, you have to handle CellValueChanged event to clear column 'Item' every time the user changes value in column 'Action' in order to avoid situation you've described (Item from ActionBList when Action = A).

Regards,

Maciej Nowicki

于 2015-04-13T10:36:29.250 回答