显示datepicker日历没有下拉按钮?

时间:2015-05-13 07:14:56

标签: c# wpf datepicker

在C#4.5 WPF窗口中,我想添加DatePicker但是采用日历样式,因此没有任何可见的TextBoxDropDown按钮。一个简单的日历视图,可以选择日期。无需输入日期。

我在以前的网络项目中做过类似的事情:

date picker web style

看起来很简单,但我找不到任何例子,我无法弄明白。

2 个答案:

答案 0 :(得分:1)

我的上帝这是可耻的..我想要自定义Datepicker控件,但默认的wpf控件中只有一个Calendar控件。

因此......关闭案件......

答案 1 :(得分:0)

尝试

<toolkit:Calendar x:Name="_calendar" DisplayModeChanged="_calendar_DisplayModeChanged" DisplayMode="Year" />
with the code behind
Private Sub _calendar_DisplayModeChanged(ByVal sender As System.Object, ByVal e As Microsoft.Windows.Controls.CalendarModeChangedEventArgs)

    If _calendar.DisplayMode = Microsoft.Windows.Controls.CalendarMode.Month Then
        _calendar.DisplayMode = Microsoft.Windows.Controls.CalendarMode.Year
    End If

End Sub