隐藏WPF DataGrid行错误 [英] Hide WPF DataGrid Row Error

查看:245
本文介绍了隐藏WPF DataGrid行错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个datagrid,我正在执行我自己的验证检查。当有错误时,我将该行的边框设置为红色,并向用户显示一条消息。但是,在我的datagrid中,还有一个红色的感叹号。我想知道是否有办法隐藏这个?我尝试检查Row.HasErrors(),但总是返回false,Row.ClearErrors()也不会删除感叹号。

解决方案

您是否已签出如何使用DataGrid控件实施验证? a>?



这取决于感叹号在DataGrid中显示的位置。例如,如果在发生验证的行上,您可以实现自己的DataGrid.RowValidationErrorTemplate或DataGrid.ValidationErrorTemplate。



有很多不同情况的示例链接。


I have a datagrid where I am implementing my own validation checks. When there is an error, I set the row's border to red and display a message to the user what the error is. However, in my datagrid, there is a red exclamation point that shows up as well. I was wondering if there is a way to hide this? I tried checking the Row.HasErrors() but that always returns false and Row.ClearErrors() won't remove the exclamation point either.

解决方案

Have you checked out How to: Implement Validation with the DataGrid Control?

It depends a bit on exactly where the exclamation point is showing in the DataGrid. For example, if it on the row where the validation occurs you can implement your own DataGrid.RowValidationErrorTemplate or DataGrid.ValidationErrorTemplate.

There are quite a few examples for various situations in the link.

这篇关于隐藏WPF DataGrid行错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆