开发者

WPF Datepicker Control None option(WPF ToolKit)

开发者 https://www.devze.com 2022-12-17 11:14 出处:网络
How to provide an option to select No dates(None) in datepicker开发者_JAVA百科 control? Please help!!

How to provide an option to select No dates(None) in datepicker开发者_JAVA百科 control?

Please help!!

Thanks Sharath


Now, I have actually installed the WPF Toolkit and tried it...

I found out that if you manually delete the text in the textbox part of the datepicker, then the SelectedDate is actually deleted. Optionally, you can add a button that deletes the SelectedDate directly.

WPF code:

    <my:DatePicker Name="DatePicker1" Height="26"  xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" />
    <Button Name="btnDeleteDate" Height="26"  Width="90">Set no date</Button>

Code behind (VB):

Private Sub btnDeleteDate_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnDeleteDate.Click
    DatePicker1.SelectedDate = Nothing
End Sub

If you want the todays date not to be highlighted as grey, you can set IsTodayHighlighted to false.

It is still the "active date" though, which is a visible box around a date that is kind of a "cursor" that is the start point if you move around with the arrows on the keybord. This is not the same as SelectedDate, but the selected date is set immediately when you start to move it around.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号