wpf - 在 WPF 中使用 ValidatesOnExceptions=true 时抛出 ArgumentException 时如何防止调试器中断

标签 wpf validation data-binding

我正在使用 WPF 验证的 ValidatesOnExceptions=true 方法。这涉及在源的属性 setter 方法中抛出异常。它工作但调试器总是在抛出异常时中断。我猜这是因为异常没有直接在我的用户代码中捕获,而是在 WPF 验证代码中捕获。无论如何要停止这种行为,还是只是您使用这种验证方法时付出的代价?

最佳答案

在 Visual Studio 中,转到 Debug - Exceptions... 并取消选中 User-unhandled

我认为工具 - 选项... - 调试 - 常规 - 必须选中“仅启用我的代码”才能看到此选项

如果您想禁用特定异常的中断,请说 System.Exception,然后展开 System 并取消选中 System.Exception

关于wpf - 在 WPF 中使用 ValidatesOnExceptions=true 时抛出 ArgumentException 时如何防止调试器中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4020207/

相关文章:

wpf - 为什么每次创建新 View 模型时都不会调用 View 构造函数?

c# - WPF - 将 Storyboard放入资源字典

c# - 使用 http :\\URL 的 WPF 图像 UriSource 和数据绑定(bind)

wpf - 为什么在实现 INotifyPropertyChanged 时 WPF 似乎绕过了 TypeDescriptionProviderAttribute?

templates - 如何提供预渲染的数据可绑定(bind)模板

wpf - 使用带有 HierarchicalDataTemplate 的 CollectionViewSource

c# - WPF 在 XAML 中添加带有变音符号的 KeyBinding 事件

javascript - ASP.NET Webforms - 根据 Javascript 中的验证器类型修改控件 CSS

validation - WinRT XAML 工具包 TextBoxValidationExtension 未验证 ViewModel 中的初始化绑定(bind)

validation - 如何使用 scalaz 为应用程序编写函数