I've got a Combobox bound in the following fashion:
<combobox itemssource="{Binding BoomSections}" selecteditem="{Binding XPath=SelectedRodConnectionBoomSection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" displaymemberpath="BoomSectionInstance.Description" issynchronizedwithcurrentitem="False" />
The problem I'm having is when I initially populate the value of SelectedRodConnectionBoomSection, the Combobox does not show the value of BoomSectionInstance.Description. If I put a breakpoint in the property get, the value is correct, but the value shown in the combobox is blank. If I select a value, I see all of the items populated in BoomSections (with BoomSelectionInstance.Description). I can actually select a value and the value populates on the Combobox as expected. So... The problem appears to be in the initialization of the value. Any thoughts?
BoomSections is defined as:
Public Property BoomSections As ObservableCollection(Of BoomSectionViewModel)
Get
Return _boomSections
End Get
Set(value As ObservableCollection(Of BoomSectionViewModel))
_boomSections = value
NotifyPropertyChanged(Function() BoomSections)
End Set
End Property
SelectedRodConnectionBoomSection is defined as:
Public Property SelectedRodConnectionBoomSection As BoomSectionViewModel
Get
Return _selectedRodConnectionBoomSection
End Get
Set(value As BoomSectionViewModel)
_selectedRodConnectionBoomSection = value
NotifyPropertyChanged(Function() SelectedRodConnectionBoomSection)
End Set
End Property
The BoomSectionViewModel contains a property called BoomSectionInstance is defined as:
Public Property BoomSectionInstance As BoomSection
Get
Return _boomSectionInstance
End Get
Set(value As BoomSection)
_boomSectionInstance = value
NotifyPropertyChanged(Function() BoomSectionInstance)
End Set
End Property
The BoomSection represents an entity defined by:
Namespace Entities
''' <summary>
''' Class containing Entity Definition for a Boom
''' </summary>
''' <remarks></remarks>
<Table("BoomSections")>
Public Class BoomSection
Inherits ViewModelBase
Implements IBaseProperties
Public Sub New()
Id = Guid.NewGuid()
End Sub
<Key>
Public Property Id As Guid Implements IBaseProperties.Id
Public Property Description As String Implements IBaseProperties.Description
End Class