Shubham Gangrade

Shubham Gangrade

  • NA
  • 73
  • 19.1k

How to set Combo box value in WPF using MVVM architecture

May 19 2020 8:27 AM
I created a POC in WPF MVVM architecture.In which I used combo box control you can see in the code below.
 
<ComboBox Name="DeptCombo" Grid.Row="4" Grid.Column="1" ItemsSource="{Binding DepartmentList,Mode=TwoWay}" SelectedItem="{Binding Path=CurrentDepartment,Mode=TwoWay}" DisplayMemberPath="DepartmentName">
</ComboBox>
 
Everything is fine, I binded that combo , saved that combo value in the database, But the only problem I was facing is, I am not able to set the saved database value in that combo.I don't get any solution regarding that.Please help me.

Answers (3)