I have a ControlTemplate for a control (i.e. Cell in DataGrid) and I want to change the background of the Row if a cell is selected. I did not do this on Row because the SelectionUnit is set to cells.
Any ideas how I can change the background of the row if the cell is selected?
the DataGridRow containing the DataGridCell is the ancestor of this DataGridCell in the visual tree.
(you can find the ancestor using VisualTreeHelper.GetParent())
So handle the selectionChanged event, find the row and change its background (keeping track of the row and previous row background to restore it during the next SelectionChanged)