2011-12-13 89 views

回答

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.