Hi there
I have search the web flat and it seems like my googling skills let me down. I was not able to add a "not selected" item to a bounded comboBox. Is there a way to do it with the XamComboEditor?
This is what I wanted to do... But with no success.
<igEditors:XamComboEditor ItemsSource="{Binding Source={StaticResource odpStockNo}}" ValuePath="IDStockNo" Value="{Binding Path=FKStockNo}" DisplayMemberPath="StockNo" Name="igCombo"> <igEditors:ComboBoxItemsProvider> <igEditors:ComboBoxItemsProvider.Items> <igEditors:ComboBoxDataItem DisplayText=" not selected " Value="-1"/> </igEditors:ComboBoxItemsProvider.Items> </igEditors:ComboBoxItemsProvider> </igEditors:XamComboEditor>
but it seems like it is not possible to add an item to a already bounded object. Is there a work around? It cant be that difficult?! It is standard in asp and WinForms!
Regards
Christo
It seems like you were right about WinForms. But one of our developers is doing it in asp, and some of the other said that they have done it in WinForms, but for some reason they could not show me how...
What I cant understand is why!?!? It have to one of the most basic functions of a combo box! Is it not?
Thank you for the blog post. It looks like it might do the trick. We will be looking into making our own control that can handle it easily. It would be a nice feature to add to the XamComboEditor.
Kind regards
Chris2L said:It is standard in asp and WinForms!
I can't speak for ASP but in WinForms, you couldn't do both. If you set the ItemsSource then you couldn't add items to the Items collection - it would throw an exception. The same is true for our xamComboEditor and the intrinsic WPF combobox. If you are going to use the ItemsSource then you will need to add an item to the collection or perhaps you could write a custom wrapper collection that adds extra items around the main collection. Another approach is one discussed here regarding use of a CompositeCollection.