WPF DataGrid: Template Column: Nested Usercontrols with popup problem.

Dec 20, 2008 at 4:17 PM
Hi There,

I have experienced this problem in data grid, template column.

1. I have one control having a combo and a checkbox control (arranged in a plain grid). They are internally bound to some data.
2. I have another user control that hosts the above control (control 1) in a popup. The popup is opened and closed using  a toggle button. So this control simply hosts a toggle button and has an associated popup that wraps the above control in a stack panel.
3. I host the template of above user control (control 2) in the cell template of the datagrid's template column.

I load the UI, the datagrid displays rows which correctly repeat control 2. I click the toggle button from some cell and the popup opens. But all the controls in the popup (checkbox and combo) are not responding to any clicks or keyboard events that I perform on them. I can neither uncheck\check the checkbox nor select any entry from combobox. I cant even see any binding in combobox.

I have successfully reproduced it in another WPF project with other type of set of controls (buttons, textboxes, listbox etc.). They too become unresponsive. Its always the hierarchy of user controls hosted in popups that give problem on datagrid template column.

It is even more irritating when I implement the same template in DataGridTemplate.CellEditingTemplate instead of DataGridTemplate.CellTemplate. Because in that case the control automatically hides if I try to click the combobox and goes in non edit state.

This bug is lost if

1. I merge user control 1 and 2 in a single user control and host that control in the template column of the data grid. I can expand the combo, check\uncheck the checkbox.
2. I implement the same template in a Listview or Listbox's ItemTemplate. The controls on the popup are correctly responsive in such case.  

Can someone guide me here...

If you want, I can attach an example... but I would really appreciate if someone else tries to reproduce it on his/her side as well so that I can be assured that there isnt any WPF ghost on my machine... ;-)


   - Vinit.