// 右对齐风格 Style styleRight = new Style(typeof(TextBlock)); Setter setRight = new Setter(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Right);styleRight.Setters.Add(setRight); foreach (DataGridColumn c in yourDataGrid.Columns) { DataGridTextColumn tc = c as DataGridTextColumn; if (tc != null) { tc.ElementStyle = styleRight; } }