Fixed issue with data grid template in CellOrRowHeader

As discussed in the discussion of the pull request #1446, there was still the issue when the datagrid was in CellOrRowHeader selection unit.

This fixes that issue.