I\'m using a WPF4.0 DataGrid. When double clicking on a cell in a new row everything works fine unless I\'ve added a cell style to that column. For example, I h
I had the same issue and got it solved now. If you want to do it inside the c# code, you need to set a bunch of setters:
DataGridTextColumn numColumn = new DataGridTextColumn
Style s = new Style();
s.Setters.Add(new Setter(HorizontalAlignmentProperty, HorizontalAlignment.Stretch));
s.Setters.Add(new Setter(HorizontalContentAlignmentProperty, HorizontalAlignment.Right));
s.Setters.Add(new Setter(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Stretch));
s.Setters.Add(new Setter(TextBlock.TextAlignmentProperty, TextAlignment.Right));
numColumn.CellStyle = s;