限制 DatePicker 中的日期范围 [英] Limit date range in a DatePicker

查看:33
本文介绍了限制 DatePicker 中的日期范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,是否有任何关于该工具包的真实文档?我想要的是指定一系列可选日期.例如,我不想显示今天之前的日期.如果用户选择 2012 年 1 月 27 日的开始日期,我只想允许返回日期在这些日期之后

First of, is there any real documentation of the toolkit ? What I would like is to specify a range of selectable dates. For example I don't want to display dates before today. If the user select a start date of Jan. 27th 2012, I want to allow only dates after these for the return date

推荐答案

工具包的文档有点少 - 最好的办法是查看示例应用程序的源代码,但它们并未涵盖所有场景.

Documentation is a little bit sparse for the toolkit - your best bet is to look in the source of the sample app but they don't cover all the scenarios.

默认控件似乎不支持所选日期的最小值或最大值,但如果您下载源代码,您应该能够根据需要对其进行修改.源代码的布局非常简单,您应该能够找到一个可接受的位置来添加代码,您唯一需要决定的是如何从 UI 角度处理它.在我看来,一旦控件返回,您最好处理范围检查 - 如果它是无效日期,则弹出一条消息并重新显示控件.

The default control doesn't seem to support a minimum or maximum value for the selected date, but if you download the source you should be able to modify it according to your needs. The layout of the source is pretty straightforward and you should be able to find an acceptable place to add the code, the only thing you need to decide is how you handle it from a UI perspective. In my opinion, you are better off handling the range check once the control returns - if it is an invalid date, pop up a message and re-show the control.

这篇关于限制 DatePicker 中的日期范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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