限制TimePicker中的可选时间值 [英] Restricting selectable time values in TimePicker

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

问题描述

是否可以限制TimePicker控件提供的时间值?


用例是 - 如果我希望用户从一组可用中选择从时间选择器预约时间段,我只想显示某一天可用的时间。  在我看来,我需要使用ComboBox,但我认为
我会问是否有某种方法可以使用TimePicker控件。





解决方案

Hello Dpakpaul_42,


欢迎使用
开发通用Windows应用论坛!
 


请阅读粘性帖子,尤其是  引导
发布:主题行标记
   已知
Windows 10 SDK和工具的问题 


请不要忘记在您的案例中添加标签,以便我们了解您的项目类型。


>> 是否可以限制TimePicker控件提供的时间值?


< p style ="margin:0px">目前
TimePicker类
不向我们提供此API。唯一可能的我认为是使用

TimeChanged
活动并将时间更改回您想要的时间然后向用户弹出一些内容并告诉他们时间超出了您设置的范围。


如果你想显示具有预期范围的UI,那么你可能需要创建自己的timepicker控件而不是使用默认的TimePicker class。


祝你好运,


Barry



Is it possible to restrict the time values that are presented by the TimePicker control ?

The use case is - If I wanted the user to pick from a set of available appointment time slots from a time picker, I'd like to show only the times that are available on a given day.  It seems to me that I need to use a ComboBox instead but I thought I'd ask if there was some way to use the TimePicker control.

解决方案

Hello Dpakpaul_42,

Welcome to the Developing Universal Windows apps forum! 

Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools .

Please don't forget to add tags to your case so that we can know your project type.

>>Is it possible to restrict the time values that are presented by the TimePicker control ?

Currently the TimePicker class does not provide this API to us. The only possible way I think is to use TimeChanged event and change the time back to the time you want. Then pop up something to your user and telling them that the time is out of the range you set.

If you want to show the UI with the expected range, then maybe you need to create your own timepicker control instead of using the default TimePicker class.

Best regards,

Barry


这篇关于限制TimePicker中的可选时间值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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