[英]How to disable month selection in Calendar
I'm wondered how to disable the selection of the month in the calendar, if I click on in July as shown in the first image, it opens the selection of the month and continue with the selection of the year (see second image).我想知道如何禁用日历中月份的选择,如果我在七月单击,如第一张图片所示,它会打开月份的选择并继续选择年份(见第二张图片)。 How can I disable this?
我怎样才能禁用它?
Set the SelectionMode
property to DayWeek .将
SelectionMode
属性设置为DayWeek 。 You can find more information at How to: Control User Date Selection in a Calendar Web Server Control您可以在如何:在日历 Web 服务器控件中控制用户日期选择中找到更多信息
Handle the event for changing the display mode, and if it's not in month mode then reset it back to being in month mode.处理更改显示模式的事件,如果它不在月模式下,则将其重置回月模式。
XAML: XAML:
<UserControls:MonthViewCalendar x:Name="schedCalendar" Grid.Row="1" DisplayModeChanged="MonthViewCalendar_DisplayModeChanged"/>
C# Code Behind for event handler事件处理程序的 C# 代码隐藏
private void MonthViewCalendar_DisplayModeChanged(object sender, CalendarModeChangedEventArgs e)
{
if (e.NewMode != CalendarMode.Month)
{
schedCalendar.DisplayMode = e.OldMode;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.