RadDatePicker 输入事件
我正在寻找在 RadDatePicker (一个 Telerik 控件)中输入文本时在控件上触发的某种事件。
每次击键时都必须触发它。
我尝试捕获 keyup 事件,该事件工作正常,但是...如果我在字段中输入了类似 1/1/201(这是一个不完整的日期)的内容,则 SelectedValueProperty 不会设置为我输入的不完整日期。
那么我为什么想要那个呢?我应该解释一下。当我发现字段中的某些内容发生更改时,我想要更新日期绑定到的字段(例如在 WPF 中使用 UpdateSourceTrigger.PropertyChanged)。
该字段(以及其他字段)中的内容将决定页面上的另一个按钮是否处于活动状态。
我猜测该解决方案与普通的 DatePicker 相同,因为它归结为 RadDatePicker 有一个内部 TextBlock,可以在其中输入/编辑日期。
谢谢,
彼得。
I was looking for some kind of event that is fired on a RadDatePicker (a telerik control) when text is typed into the control.
It must be fired on every key stroke.
I tried to grab the keyup event, which works fine, but ... if I have typed into the field something like 1/1/201 (which is an incomplete date) the SelectedValueProperty is not set to the incomplete date that I have typed.
So why do I want that? I should explain. When I find that something in the field is changed I want to update the field that the date is bound to (like using UpdateSourceTrigger.PropertyChanged in WPF).
What is in that field (and other fields) will determine whether another button on the page is active or not.
I am guessing that the solution would be the same as a normal DatePicker because what it comes down to is that a RadDatePicker has an internal TextBlock where the date is typed / edited.
Thanks,
Peter.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了这个问题的答案,效果非常好。
RadDatePicker 控件上有一个名为 CurrentDateTimeText 的属性。我绑定到此,不是为了获取日期(我还绑定到 SelectedValue 来获取日期),而是为了让我可以判断用户是否在字段中输入了任何内容。
I found an answer for this question that works quite nicely.
On the RadDatePicker control there is a property called CurrentDateTimeText. I am binding to that, not to get the date (I am also binding to the SelectedValue to get the date) but just so that I can tell if the user has entered anything into the field or not.
您可以使用 jQuery 轻松做到这一点:
You can easily do it with jQuery: