简体   繁体   English

RadDateTimePicker将日历更改为月视图

[英]RadDateTimePicker Change Calendar to Month View

is there a way for me to format the raddatetimepicker to have a month and year view on selection view?.. 有没有办法格式化raddatetimepicker以在选择视图上显示月和年视图?

something like this.. 像这样

在此处输入图片说明

what I have tried so far is this: 到目前为止,我尝试过的是:

dateStartDate.Value = DateTime.Now;
dateStartDate.Format = DateTimePickerFormat.Custom;
dateStartDate.CustomFormat = "MMMM - yyyy";
dateStartDate.ShowUpDown = true;

在此处输入图片说明

but it doesn't show the view anymore instead gives me an up and down button to change the month.... 但它不再显示视图,而是给我一个updown按钮来更改月份。

I am Using C# as my language and telerik ..... and this is a windows form... 我正在使用C#作为我的语言和telerik .....这是Windows窗体...

Not sure if you have read this or not, but I think it'd certainly help point you to the right direction. 不知道您是否阅读过此书,但我认为这一定会帮助您指出正确的方向。

Customize RadCalendar Programmatically 以编程方式自定义RadCalendar

Essentially, you will need to get a reference of RadCalendar from your RadDateTimePicker control, and from there, you can start customising its calendar view based on your own need. 本质上,您需要从RadDateTimePicker控件中获取RadCalendar的引用,然后从那里开始根据自己的需要自定义其日历视图。

RadDateTimePickerCalendar calendarBehavior = this.dateStartDate.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar;
RadCalendar calendar = calendarBehavior.Calendar as RadCalendar;
RadCalendarElement calendarElement = calendar.CalendarElement as RadCalendarElement;

Update 更新资料

In your case, I think you will be looking at the ZoomLevel of RadClaendar. 对于您的情况,我认为您将查看RadClaendar的ZoomLevel。 Something like this 像这样

calendar.HeaderNavigationMode = HeaderNavigationMode.Zoom;
calendar.ZoomLevel = ZoomLevel.Months;

Customize Zoom Navigation 自定义缩放导航

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM