private void dataGrid_show_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
if (dataGrid_show.Columns != null && (dataGrid_show.Columns.Count + 1) % 2 == 1)
{
e.Column.CellStyle = new Style(typeof(DataGridCell));
e.Column.CellStyle.Setters.Add(new Setter(DataGridCell.BackgroundProperty,
new SolidColorBrush(Colors.LightBlue)));
e.Column.CellStyle.Setters.Add(
new Setter(DataGridCell.HorizontalAlignmentProperty,
HorizontalAlignment.Left));
....
}
}
private void dataGrid_show_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
if (dataGrid_show.Columns != null && (dataGrid_show.Columns.Count + 1) % 2 == 1)
{
e.Column.CellStyle = new Style(typeof(DataGridCell));
e.Column.CellStyle.Setters.Add(
new Setter(DataGridCell.BackgroundProperty,
new SolidColorBrush(Colors.LightBlue)));
e.Column.CellStyle.Setters.Add(
new Setter(DataGridCell.HorizontalAlignmentProperty,
HorizontalAlignment.Left));
....
}
}
列线是这个,为什么?