1

I have a WPF app using MVVM. I have a DataGrid on the form and the DataGrid has a column with a ComboBox that contains an ObservableCollection.

I want to add a "Please Select From List" to the top of the ComboBox. I tried using CompositeCollection to do this but could not get the ObservableCollection list to bind to the combobox, but the "Please Select" did bind OK.

How can I add a "Please select" to the top of the ComboBox in this scenario? Does anyone have an example of this?

Here is what I tried: XAML:

<UserControl.Resources>
    <MyVM:MyViewModel x:Key="MyDataList"/>
</UserControl.Resources>

<ComboBox....   
   <ComboBox.ItemsSource>
       <CompositeCollection>
            <ComboBoxItem>Select Address Type</ComboBoxItem>
                  <CollectionContainer Collection="{Binding Source={StaticResource MyDataList}}" />
       </CompositeCollection>
   </ComboBox.ItemsSource>
Jerry
  • 6,357
  • 8
  • 35
  • 50

0 Answers0