I'm trying to programmatically generate combo box items. I'm very new to WPF and don't understand where I'm making a mistake.
This is my List<string>:
public class StatusList : List<string>
{
public StatusList()
{
this.Add("aaa");
this.Add("bbb");
this.Add("ccc");
this.Add("ddd");
}
}
And I'm trying to show these items in
<DataTemplate>
<ComboBox Height="22" ItemsSource="{StaticResource StatusList}" SelectedItem="{Binding Status}" />
</DataTemplate>
But ItemsSource="{StaticResource StatusList}" is not recognized
ItemsSource="{StaticResource StatusList}"tryItemsSource="{Binding StatusList}"ItemsSource="{Binding StatusList}"do not work, I'll look at obervableCollectionStatusListis a class not a property, try Rahul's answer