ComboBox Itemssource
Posted: 11 Aug 2021, 13:08
Hello there
In this case I am using codebehind and no viewmodel
I am using ItemsSource = a dictionary of type Dictionary<MyEnum, string>();
If I use a list, it works just fine and it's not that the rows are just looks empty, it looks like the combobox is totally empty.
Works fine in Blend-version, but in Noesis it doesn't. The elements are not shown in the combobox. I get no error, and if I instead just use comboBox.Items.Add(item) for each item, it works.
Is there something with the ItemsSource property in Noesis that I should have known?
I am not using Binding anywhere and I have not set DataContext.
As you can see I have also tried to set the paths using code, but that makes no difference, I can see that they are detected from xaml, so it's not that.
In this case I am using codebehind and no viewmodel
I am using ItemsSource = a dictionary of type Dictionary<MyEnum, string>();
If I use a list, it works just fine and it's not that the rows are just looks empty, it looks like the combobox is totally empty.
Works fine in Blend-version, but in Noesis it doesn't. The elements are not shown in the combobox. I get no error, and if I instead just use comboBox.Items.Add(item) for each item, it works.
Is there something with the ItemsSource property in Noesis that I should have known?
I am not using Binding anywhere and I have not set DataContext.
Code: Select all
<ComboBox x:Name="ddl_SearchType" DisplayMemberPath="Value" SelectedValuePath="Key" SelectionChanged="ddl_SearchType_SelectionChanged" />Code: Select all
ComboBox ddl_SearchType;
ddl_SearchType = this.FindName(nameof(ddl_SearchType)) as ComboBox;
//ddl_SearchType.DisplayMemberPath = "Value";
//ddl_SearchType.SelectedValuePath = "Key";
ddl_SearchType.ItemsSource = searchTypeEnumDictionary;
//foreach (var item in searchTypeEnumDictionary)
//{
// ddl_SearchType.Items.Add(item);
//}