我使用ComboBoxEdit(DevExpress)和CheckedComboBoxStyle設置過濾器。我如何通過代碼選擇一些項目?在ComboBoxEdit中選擇幾個項目
1
A
回答
1
請必需項添加到ComboBoxEdit.SelectedItems收集
標記:
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
...
<dxe:ComboBoxEdit x:Name="cbEdit" IsTextEditable="False">
<dxe:ComboBoxEdit.StyleSettings>
<dxe:CheckedComboBoxStyleSettings />
</dxe:ComboBoxEdit.StyleSettings>
</dxe:ComboBoxEdit>
後面的代碼:
string[] platforms = new string[] { "Win98", "Win2000", "WinNT", "WinXP", "Vista", "Win7" };
cbEdit.ItemsSource = platforms;
cbEdit.SelectedItems.Add(platforms[4]);
cbEdit.SelectedItems.Add(platforms[5]);
2
根據文檔:
http://documentation.devexpress.com/#WindowsForms/clsDevExpressXtraEditorsCheckedComboBoxEdittopic
要編輯一組布爾選項,添加相應的項目到RepositoryItemCheckedComboBoxEdit.Items集合。每個項目由一個CheckedListBoxItem對象表示,提供下列選項:
ListBoxItem.Value - represents the item's value. Typically, this property must specify a unique string. For check items, it's also possible to specify the display text via the CheckedListBoxItem.Description property.
CheckedListBoxItem.CheckState - represents the item's check state (checked or unchecked). The indeterminate state is not supported.
CheckedListBoxItem.Enabled - specifies whether the item's state can be changed by an end-user.
相關問題
- 1. DOMXPath - 只選擇幾個項目
- 2. 如何在DevExpress ComboBoxEdit中選擇第一項?
- 3. ListView ItemClickListener選擇幾個項目時,我點擊一個
- 4. 在MYSQLdb中選擇單個項目 - Python
- 5. android在ListView中選擇多個項目?
- 6. 在ListView Android中選擇多個項目
- 7. 在JTextPane中選擇多個項目
- 8. 在formview中選擇項目根據下拉選擇的項目
- 9. 在gridview中選擇項目
- 10. 在Asp.Net中選擇項目?
- 11. 在AngularJS的選擇標籤中選擇一個項目
- 12. 如何在asp.net mvc中選擇一個選擇列表項目?
- 13. JSoup - 選擇多個項目
- 14. 選擇多個項目
- 15. XSLT選擇多個項目
- 16. 隱藏選擇項目,如果另一個選擇項中選擇
- 17. 由幾個選項
- 18. LINQ組項目。單個項目可能在幾個組中
- 19. 如何使用jquery從選擇框中刪除幾個選項?
- 20. 當選擇一個項目時,AngularJS選擇框選項消失
- 21. 設定選擇的項目MD-選擇與多個選項
- 22. 同時在幾個項目中工作
- 23. 選擇popUpContextMenu中的第一個項目
- 24. 從列表中選擇單個項目
- 25. 選擇kendoComboBox中的第一個項目
- 26. SQL選擇工會中多個項目
- 27. 選擇RadComboBox中的第一個項目
- 28. 如何選擇只有一個項目時選擇多個項目
- 29. 從mysql中選擇項目
- 30. 如何在symfony中的實體/選擇類型中檢查幾個選項
windows窗體是否正確?你如何用物品填充組合框控件?你嘗試循環所有可用的項目並設置選中/選定的屬性? – 2011-12-13 18:43:04
WPF。填充使用ItemsSource – 2011-12-13 19:06:32