Suppose we have a DataSource bind to a collection from Database. There is no null item of course. How to add a void item into a ComboBox, so that at first load user would see an empty string. I don't want to add a dummy/void object into the Collection. Optimally in XAML. Any proposals?
<ComboBox Name="myComboBox" Width="200" Background="White"> <ComboBox.ItemsSource> <CompositeCollection> <ComboBoxItem IsEnabled="False" Foreground="Black">Select Item</ComboBoxItem> <CollectionContainer Collection="{Binding Source={StaticResource DataKey}}" /> </CompositeCollection> </ComboBox.ItemsSource> </ComboBox>
EDIT
As @surfen mentioned in comment, BindingProxy is workaround for the binding issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With