问题描述
我不知道如何在WPF中使用DateTimePicker控件。
I have no idea how to use the DateTimePicker control in WPF. It is not available in the Toolbox.
推荐答案
请注意:以下答案仅适用于WPF在.NET Framework 3.5框架下,它具有自己的。
Please Note: The following answer only applied to WPF under the 3.5 Framework as NET 4.0 runtime has it's own datetime control.
默认情况下,WPF 3.5不带有像Winforms这样的日期时间选择器。
By default WPF 3.5 does not come with a date time picker like winforms.
但是在。我猜它会在将来的版本中成为框架的一部分。
However a date picker has been added in the WPF tool kit produced by Microsoft which can be downloaded here. I guess it will become part of the framework in a future release.
添加对WPFToolkit.dll的引用很简单,在工具框中查看并分发
It is simple to add a reference to the WPFToolkit.dll, see it in the tool box and distribute with your application by following the instructions on the website.
在此应用可用之前,其他人已经创建了第三方选择器(您可能更喜欢),或者使用了不太理想的解决方案在WPF应用程序中使用Winforms控件的方法。
Before this was available other people had created 3rd party pickers (which you may prefer) or alternatively used the less ideal solution of using the winforms control in a WPF application.
更新:这样的问题与,该链接还具有指向以及其他链接。
Update: This so question is very similar this one which also has a link to a walk through for the datepicker along with other links.
这篇关于如何在WPF中使用DateTimePicker?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!