Margin of DataGridComboBoxColumn vs DataGridTextColumn

Oct 15, 2009 at 10:11 AM

Hello,

when using DataGridComboBoxColumn and DataGridTextColumn next to each other, the default margins differ meaning that the text in each row is not aligned.

The default margin for the TextBlock generated by DataGridTextColumn is set to 2,0,2,0 (in code), while the Margin for DataGridComboBoxColumn (when not being edited) is determined by the default template for DataGridComboBoxColumn+TextBlockComboBox, with an explicit margin of 1,1,1,1. To make things worse, it's not possible to replace the default template for DataGridComboBoxColumn+TextBlockComboBox since the class is internal.

I've thought about putting a negative margin somewhere (ElementStyle?) but that seems like a hack - does anyone have any proper way of solving this?