O
O
olifem2018-02-17 17:56:52
WPF
olifem, 2018-02-17 17:56:52

How to read value from combobox?

How to write and read a value from a comboBox in C# WPF
Values ​​are taken from the database (id, name) The name field is displayed in the drop-down list, when you click on it, only id should be selected
How to assign an id, maybe there is something like value or bind, but as?
And how to count the value when fetching

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2018-02-17
@Nipheris

The exact answer depends on how and what you linked the combobox to. I usually use normal viewmodels for combobox items, so I bind SelectedItem . In the case of using bindings, the question of reading the value when choosing should not be.

D
d-stream, 2018-02-19
@d-stream

As a human being - use MVVM - then the binding will be exactly as intended.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question