2011-12-13 16 views
1

私はComboBoxEditDevExpress)とフィルタを設定するのにCheckedComboBoxStyleを使用します。コードでいくつかのアイテムを選択する方法は?ComboBoxEditでいくつかのアイテムを選択

+0

windowsフォームは正しいですか? ComboBoxコントロールにアイテムをどのように埋め込んでいますか?利用可能なすべてのアイテムをループし、チェック/選択プロパティを設定しようとしましたか? –

+0

WPF。 ItemsSource –

+0

を使用して記入すると、このヘルプが表示されますか? http://www.devexpress.com/Support/Center/p/Q330727.aspx?searchtext=set+checked+items –

答えて

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

ドキュメントによると:RepositoryItemCheckedComboBoxEdit.Itemsコレクションに対応する項目を追加し、ブールオプションのセットを編集するには

http://documentation.devexpress.com/#WindowsForms/clsDevExpressXtraEditorsCheckedComboBoxEdittopic

。各項目は、以下のオプションを提供し、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. 
+0

申し訳ありません。 WPFコントロール。 –

関連する問題