Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何防止文本框Datepicker接受字符串作为输入或无效日期作为输入?
Datepicker
我已经尝试通过添加AddError()atDateValidationError事件Datepicker,但它对我不起作用。
AddError()
DateValidationError
如果您无法解析输入,您可以注册TextChanged事件并恢复之前的值。请注意,这将禁用按字符插入日期字符串的常见编辑方案。DatePickerTextBox
TextChanged
DatePickerTextBox
您应该澄清您的问题,并说明您是要拒绝无效文本还是触发错误提供程序。