Click here to Skip to main content
15,922,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyBody!
i'm building an application in wpf and I'm facing a problem when binding my combobox to my datagrid. I've a combobox cbTeacher on my form and a datagrid dgteacher.

Firstly I fill my combobox using a service:
exemple: cbTeacger.ItemsSource = new ClientServices.ClientService().Services.svc_load_Teacher();

because the teacher informations comes from an other Table.
so when i drop down my combobox I have the entire list of my teachers.

The combobox is binded to my datagrid (dgteacher) so that after completing the form and saving data to database I can see all lines of informations stored in database directly from the datagrid.

The problem is , when navigating through each line of my datagrid I don't see the informations bound to my combobox.
Clearly the combobox stay like there is no selecteditem or selectedindex. I don't know why??

Someone can help ?

1 solution

ComboBox has the fallowing properties:
- DisplayMember and
- ValueMember
Both represents data in ComboBox, but first for displaying values, second for linked values which corresponds with SelectedValue and SelectedItem.

Before you start navigate trough lines in datagrid, try to store ComboBox value in variable.
Share this answer
zekotch 27-Oct-10 13:14pm    
I tryed with the SelectedValue but it's the same result. I don't know why?
I haven't problem to store the Combobox value in a variable.
It's weird! How is it possible I can store Combobox value in the database and the value is still visible in the datagrid and not visible in the combobox ???
I'm wondering.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900