Как связать DataGridComboBoxColumn с EntityFramework, используя MVVM?

Я пытаюсь заставить DataGridComboBoxColumn работать с моей ViewModel. Кажется, все работает правильно, но когда я изменяю значение поля со списком, сущность не изменяется.

Текст данных окна имеет следующие свойства:

ItemsSource

Public Property AllEnergySources() As ObservableCollection(Of EnergySourceViewModel)

SelectedItemBinding

  Private _CurrentEnergySource As EnergySourceViewModel
    Public Property CurrentEnergySource() As EnergySourceViewModel
        Get
            Return _CurrentEnergySource
        End Get
        Set(ByVal value As EnergySourceViewModel)
            _CurrentEnergySource = value
            OnPropertyChanged("CurrentEnergySource")
        End Set
    End Property

Я чувствую, что проблема заключается в том, как я заполняю CurrentEnergySource в ViewModel, который является DataContext:

Sub New(SelectedEntity as EquipmentEnergySource)
     AllEnergySources = New ObservableCollection(Of EnergySourceViewModel)

    //Select all EnergySources from the EntityFramework
     Dim EnergyEntities = From esr in db.EnergySources Select esr

                //Loop through to convert Entity POCO to Collection of ViewModels
                For Each es In EnergyEntities
                    _AllEnergySources.Add(New EnergySourceViewModel(es))

                    //Optionally Set the newly created ViewModel to SelectedItemBinding object
                    If es.EnergySourceID = SelectedEntity.EnergySourceID Then
                        _CurrentEnergySource = _AllEnergySources.Last
                    End If
                Next
End Sub

Когда я создаю резервную коллекцию для комбинированного списка, если выбранная модель, я устанавливаю эту модель представления в качестве CurrentEnergySource, но после этого она отключается (и это проблема)

На что я должен ссылаться в CurrentEnergySource, чтобы он обновлял модель при изменении поля со списком?

Ответы на вопрос(4)

Ваш ответ на вопрос