There is a combobox whose itemssource is filled from the database

UFSSPEntities context = new UFSSPEntities(); var RepliesVS = (CollectionViewSource)FindResource("RepliesVS"); context.Replies.Load(); RepliesVS.Source = context.Replies.Local; 

In the following way it becomes attached:

 ItemsSource="{Binding Mode=OneWay, Source={StaticResource RepliesVS}}" DisplayMemberPath="Description" SelectedValuePath="ID" SelectedValue="{Binding Path=REPLY}" 

If the REPLY field is null, then the first value is selected in the combobox. How can I get an empty item selected instead?

  • What is an “empty element”? Is he in your collection? - VladD
  • No, it is not. I will not be able to add an element to the database whose primary key will be NULL - Sergеu Isupov
  • But in the collection, you can add it? An empty element has to come from somewhere. - VladD

0