From DataGridBeginningEditEventArgs
, you could access the generated element for the cell about to be edited like this:
var contentComboBox = e.Column.GetCellContent(e.Row) as ComboBox;
However, I'm not sure that this will get the actual ComboBox you need. DataGrids can generate two different elements for each cell, depending on whether they are in edit mode (read-only and read-write elements). Since BeginningEdit
happens just before entering edit mode, this will get the read-only element.
The better event to handle this in would probably be PreparingCellForEdit, which will fire after BeginEdit
is actually called on the data item (in other words, if BeginningEdit
was not canceled). In that event, you can access the element directly through the EditingElement property.