WPF 工具包日历控件 - 如何防止下个月滚动?

发布于 2024-08-03 17:29:07 字数 154 浏览 1 评论 0原文

当WPF工具包(并包含在.Net 4中)提供的日历控件显示在“月视图”中时,它会显示上个月和下个月的天数,填满整个日历。当您点击上个月或下个月的某一天时,它会自动向后或向前滚动一个月。这种行为让我的用户感到厌烦。

有什么办法可以防止这种自动滚动的发生吗?

谢谢!

When the calendar control provided in the WPF toolkit (and included in .Net 4) is displayed in "month view", it displays days from the previous and the next month, filling up the entire calendar. When you click on a day of the previous or next month, it will scroll a month backwards or forwards automatically. This behavior is throwing my users off.

Is there any way to prevent this automatic scrolling from happening?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神经暖 2024-08-10 17:29:07

如果将 DisplayDateStart 属性设置为该月的第一天,将 DisplayDateEnd 属性设置为该月的最后一天,则其他月份的这些日子不会显示,因此无法单击。

如果您可以在 xaml 中执行此操作,它将如下所示:

 <my:Calendar Margin="50,49,48,43" Name="calendar1"  SelectionMode="MultipleRange"
     DisplayMode="Month" DisplayDateStart="2009-08-01" DisplayDateEnd="2009-08-31"/>

但只有在设计时知道日期时,这才有效。所以您可能想在代码中设置日期。

        calendar1.DisplayDateStart = new DateTime(2009, 08, 01);
        calendar1.DisplayDateEnd = new DateTime(2009, 08, 31);

当然,您需要提供特定月份的第一天和最后一天。

If you set the DisplayDateStart property to the first day of the month and the DisplayDateEnd property to the last day of the month, those days from other months are not show, and hence cannot be clicked on.

If you can do it in xaml, it would look like this:

 <my:Calendar Margin="50,49,48,43" Name="calendar1"  SelectionMode="MultipleRange"
     DisplayMode="Month" DisplayDateStart="2009-08-01" DisplayDateEnd="2009-08-31"/>

But that would only work if you knew that dates at design time. So you would probably want to set the dates in the code.

        calendar1.DisplayDateStart = new DateTime(2009, 08, 01);
        calendar1.DisplayDateEnd = new DateTime(2009, 08, 31);

Of coarse you would need to provide the first and last day of the particular month.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文