简体   繁体   English

如何制作允许您输入时间限制的 UWP 倒数计时器控件

[英]How do I make a UWP Count down timer control that allows you to input a time limit

How do I make A timer flyout that shows 0:00 and let's you select seconds and minutes?如何使显示 0:00 的计时器弹出并让您选择秒和分钟? I'm trying to work with the timePicker but I can't figure it out.我正在尝试使用timePicker但我无法弄清楚。 I only shows a clock with a time like 12:00 AM What I am looking for is almost identical to a timePicker set to the 24Hour ClockIdentifier except that when you click on the hours the flyout shows numbers from 0 to 99 instead of 0 to 24 and if you click on the minutes the flyout shows numbers from 0 to 99 instead of 0 to 60.我只显示了类似12:00 AM我在找一个时间的时钟几乎等同于timePicker集到24Hour ClockIdentifier除了当你在小时点击弹出窗口显示的数字从0到99,而不是0到24如果您单击分钟,弹出窗口会显示从 0 到 99 而不是 0 到 60 的数字。

Use a ComboBox and populate the values yourself using a List for minutes and hours.使用ComboBox并使用List自己填充几分钟和几小时的值。

Xaml: <ComboBox ItemsSource="{Binding Hours} /> Xaml: <ComboBox ItemsSource="{Binding Hours} />

C#: public List<int> Hours { get { return Enumerable.Range(0, 99).ToList(); } } C#: public List<int> Hours { get { return Enumerable.Range(0, 99).ToList(); } } public List<int> Hours { get { return Enumerable.Range(0, 99).ToList(); } }

Edit: realised you wanted 0 - 99 not 24 as I had set in the Range.编辑:意识到你想要 0 - 99 而不是我在 Range 中设置的 24。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM