WPF数据绑定和验证规则的最佳实践绑定、规则、数据、WPF

由网友(季节温暖眼瞳)分享简介:我有一个非常简单的WPF应用程序中,我使用数据绑定允许一些自定义的CLR对象的编辑。我现在想放一些输入验证,当用户点击保存研究。然而,所有的WPF书,我看了真的不投入任何空间这个问题。我看,你可以创建自定义ValidationRules,但我想知道,如果这将是矫枉过正的我的需要。I have a very simpl...

我有一个非常简单的WPF应用程序中,我使用数据绑定允许一些自定义的CLR对象的编辑。我现在想放一些输入验证,当用户点击保存研究。然而,所有的WPF书,我看了真的不投入任何空间这个问题。我看,你可以创建自定义ValidationRules,但我想知道,如果这将是矫枉过正的我的需要。

I have a very simple WPF application in which I am using data binding to allow editing of some custom CLR objects. I am now wanting to put some input validation in when the user clicks save. However, all the WPF books I have read don't really devote any space to this issue. I see that you can create custom ValidationRules, but I am wondering if this would be overkill for my needs.

所以我的问题是这样的:有一个很好的示例应用程序或文章的地方,展示最佳实践在WPF验证用户输入

So my question is this: is there a good sample application or article somewhere that demonstrates best practice for validating user input in WPF?

推荐答案

我觉得pferred方式,新的$ P $可能是使用IDataErrorInfo

I think the new preferred way might be to use IDataErrorInfo

了解更多这里

阅读全文

相关推荐

最新文章