I am working with a combo box in WPF/C# and I am having and issue that is a little confusing for me. On the combobox , I have the SelectedValue that is passing the value (TaxID) to the object on the VM, also, I have the SelectedItem that is passing the selected object from the combobox to a property on the VM. When I open a record from a Data Grid for editing, the SelectedItem is causing the combobox to be blank, it is not loading the value stored in the db. Upon removing the SelectedItem property the combobox loads properly on open for editing. I need to pass the selected object from the combobox to a property on the VM, any help is much appreciated!
<ComboBox x:Name="cboPractice"
ItemsSource="{Binding Path=PracticesList}"
DisplayMemberPath="TaxName"
SelectedValuePath="TaxID"
SelectedValue="{Binding Path=SiteVisitScheduleCurrent.TaxID,
UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding Path=SelectedPractice, UpdateSourceTrigger=PropertyChanged}"
>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding Path=PracticeSelectionChangedCommand}"
CommandParameter="{Binding ElementName=cboPractice,
Path=SelectedItem.TaxID}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>