Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
380
ComboBox in CellValuePresenter Problems
posted

I have a XamDataGrid that shows Customers and Orders (assume, we are showing their last order). I want to display a ComboBox for the Orders field with a list of all the orders for that customer and then display the last order as the Selected Value. I do not want to show all of the orders from all customers in the Order ComboBox, because the use case is to ONLY show the orders for the relevant customer in there. I hope this makes sense.

Now, I did this by overriding the CellPresenterValue Style for the Order Field and during the Loaded phase for the ComboBox, I bind the ItemSource and set the SelectedValue. However, when you scroll through the entries of the grid, the ComboBoxes get mixed up.I even tried setting it during the Initialize phase, but still suffer the same problem. Is this a known issue? Maybe, I am just doing it wrong, can you guys impart some advice for this scenario?

I have enclosed a sample project, if you build and then scroll through the entries, you will see that the Orders for CustomerA are being displayed for some other Customer. Thanks in advance.

 

DataGridZip.zip