シンプルな xaml:
<ComboBox
Height="23" Name="status"
IsReadOnly="False"
ItemsSource="?"
Width="120">
</ComboBox>
ここにドロップダウンリストのアイテムを貼り付けるС#に書き込む必要があるもの
あなたItemsSource
は、コンボリストを埋める[何か]のコレクションへの単純なバインディングです。簡単なサンプルを次に示します。
public class MyDataSource
{
public IEnumerable<string> ComboItems
{
get
{
return new string[] { "Test 1", "Test 2" };
}
}
}
<ComboBox
Height="23" Name="status"
IsReadOnly="False"
ItemsSource="{Binding Path=ComboItems}"
Width="120">
</ComboBox>
これは完全なサンプルではありませんが、アイデアは得られます。
プロパティを使用する必要がないことも注目に値しItemsSource
ます。これも許容されます。
<ComboBox
Height="23" Name="status"
IsReadOnly="False"
Width="120">
<ComboBox.Items>
<ComboBoxItem>Test 1</ComboBoxItem>
<ComboBoxItem>Test 2</ComboBoxItem>
</ComboBox.Items>
</ComboBox>