从DatePicker删除textinput [英] Remove textinput from DatePicker

查看:57
本文介绍了从DatePicker删除textinput的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 DatePicker ,并且我想消除通过键入来输入日期的可能性,这是因为即使我设置了 DisplayDateStart DisplayDayEnd ,如果您手动输入日期而不是使用日历GUI进行选择,则仍然可以到达该范围之外的日期

I have a DatePicker and I want to remove the possibility to input a date by typing, the reason for this is that even if I set a DisplayDateStart and DisplayDayEnd you can still get to dates outside this scope if you type them in manually instead of selecting them with the calendar GUI

还可以仅选择当前日期吗?

Also is it possible to make only present dates selectable?

推荐答案

要禁用键入输入,您可以使用与此答案-将样式应用于DatePicker内部使用的DatePickerTextBox类

To disable typing input you can use the same technique as in this answer - apply style to the DatePickerTextBox class that is used by DatePicker internally

<Style TargetType="{x:Type DatePickerTextBox}">
     <Setter Property="IsReadOnly" Value="True" />
</Style>

这篇关于从DatePicker删除textinput的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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