[UWP] CalendarDatePicker如何不选择当前的DateTime [英] [UWP]CalendarDatePicker how to not select current DateTime
问题描述
大家好,
Hello guys,
我正在尝试使用UWP中的CalendarDatePicker来保存一个可选的日期,这意味着我没有希望默认情况下选择当前日期。
I'm trying to use the CalendarDatePicker from UWP in order to save a date that can be optional, meaning that I don't want that by default is selected with current date.
如何在CalendarDatePicker中取消选择当前日期?
How can I deselect the current date int he CalendarDatePicker?
我注意到,如果我不知道t绑定"日期"属性,工作正常,但是,我需要绑定才能获得所选日期。
I notice that if I don't bind the "Date" property, works fine, but, I need to bind in order to get the selected date if it is selected.
任何人都可以帮助我吗?
tkx提前
Paulo Aboim Pinto
Odivelas - 葡萄牙
anyone can help me?
tkx in advance
Paulo Aboim Pinto
Odivelas - Portugal
推荐答案
Hello A Pinto,
Hello Paulo A Pinto,
请查看以下MSDN文章
CalendarDatePicker类
Please check the following MSDN article CalendarDatePicker class
"使用
日期 属性可获取或设置所选日期。默认情况下,
日期属性为null。当用户在日历视图中选择日期时,将更新此属性。用户可以通过单击日历视图中的所选日期来取消选择日期来清除日期。 "
"Use the Date property to get or set the selected date. By default, the Date property is null. When a user selects a date in the calendar view, this property is updated. A user can clear the date by clicking the selected date in the calendar view to deselect it. "
所以默认情况下它是null但不是当前日期。我的测试还表明这是UWP应用程序的行为。
So by default it is null but not current date. My test also shows that this is the behavior for a UWP app.
所以也许你有一些如下代码?
So maybe you have some code like the following?
myCalendarDatePicker.Date = DateTime.Now;
祝你好运,
Barry
这篇关于[UWP] CalendarDatePicker如何不选择当前的DateTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!