How to bind ComboBox with Entity Framework Core/XAML/WPF
Dmtr_Grms
331
Reputation points
I have selected an item Postal Info : Id , Zip Code, Locality, Municipality, County, Country
If I use a normal TextBox I see the value Country coming from the DB and I can update it.
Now I would like to go further and use a COMBOBOX on the field Country that is defined as a FK on my table Country.
I tried to find a solution on the Web and I have done some tests but I don't understand how to bind correctly a COMBOBOX that should work like this:
- TextBlock should be filled with the country value from the selected item from my context.
- I press the arrow on the ComboBox to have the list of countries recorded in my Country Table
- The selected Country is indicated in the TextBlock
- I save my selected item Postal info with the new Country code value.
Has someone some docs or examples that could help me? Thanks in advance