- [email protected]
- Posts: 19
- Joined:
ComboBox Itemssource
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);
//}
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: ComboBox Itemssource
In Noesis only types implementing IList can be used as ItemsSource. Could you please report that difference from WPF in our bugtracker?
You can convert the dictionary to an array in the meantime:
You can convert the dictionary to an array in the meantime:
Code: Select all
Dictionary<MyEnum, string> dict;
ItemsSource = dict.ToArray();
Who is online
Users browsing this forum: Google [Bot], Semrush [Bot] and 8 guests