Persist SelectedItem in Dialog to cells value and text

May 19, 2009 at 6:53 PM

I want to be able to display a dialog form when doubleclicking a cell.  The user would select an item from the datagrid in the dialog.  It would persist the text AND value back to the cell, displaying the text but saving the value.  Essentially, a glorified combobox but using dialog instead.

What I cannot figure out is:

1) How to create a cell that shows text but also saves a value hidden.

2) Persist the selecteditem in the dialog back to the cell to update those two values in #1.




May 19, 2009 at 9:17 PM

If you use a DataGridTemplateColumn, you can provide a template that contains a control that is hidden (Visibility=Collapsed). Just be sure to bind the element to your row object.

You might try to (in code) bind the dialog controls to the controls in the main DataGrid. Then, the values should transfer between the dialog and the controls in the DataGrid that are doing the pending edit into the row.