我的gridview是从SQL中读取的Datatable动态生成的,现在我想设置一个特定的列,比如说“salary”,使其具有红色背景色。我搜索了很多解决方案,但仍然没有线索。如何在WPF gridview中设置列的背景颜色
CmdString = @" select id, firstname, lastname, title, level, salary from emplpyees";
SqlCommand cmd = new SqlCommand(CmdString, con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
dt = new DataTable("employee");
sda.Fill(dt);
datagridall.ItemsSource = dt.DefaultView;
你试过使用DataGridTemplateColumn? –