WPF datagrid如何设置特定行的背景色

2025-01-05 05:39:18
推荐回答(1个)
回答1:

private void dataGrid_LoadingRow(object sender, Microsoft.Windows.Controls.DataGridRowEventArgs e)
{
DataGridRow dataGridRow = e.Row;
CommandResultInfo dataRow = e.Row.Item as CommandResultInfo;
if (某行某列的值==某值)
{
dataGridRow.Background = Brushes.Plum;
}
}

这个你可以试试