[英]Dynamically Select/Highlight Specific Rows on a DataGrid in WPF
I'm trying to dynamically select/highlight a specific row on a DataGrid
in WPF. 我正在尝试在WPF中动态选择/突出显示DataGrid
上的特定行。
The grid rows are being validated as I iterate through them. 我在遍历网格行时正在对其进行验证。 If a row's validation fails then I want the row to be selected/highlighted again so that the user will be prompted to fix the errors. 如果某行的验证失败,那么我希望再次选择/突出显示该行,以便提示用户修复错误。
Which property in the DataGrid
can I use to select/highlight a row after failed validation? 验证失败后,可以使用DataGrid
中的哪个属性来选择/突出显示行?
您想在迭代结果时尝试使用以下方法突出显示行:
grid.Rows[i].DefaultCellStyle.BackColor = Color.Red;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.