在Xaml Silverlight中添加月份选择器

时间:2013-11-01 09:52:42

标签: .net silverlight xaml

我想在Xaml Silverlight中只有月份和年份选择器以及如何进行自定义控制?

2 个答案:

答案 0 :(得分:0)

private void Calendar_DisplayModeChanged(object sender, CalendarModeChangedEventArgs e)
        {
            if (sender is Calendar && e.NewMode != CalendarMode.Year)
                (sender as Calendar).DisplayMode = CalendarMode.Year;
        }

答案 1 :(得分:0)

您可以使用日历控件,

 <sdk:Calendar Height="169" HorizontalAlignment="Left" Margin="86,48,0,0" Name="calendar1" VerticalAlignment="Top" Width="230" DisplayModeChanged="calendar1_DisplayModeChanged" />

在代码背后,

        if (calendar1.DisplayMode == CalendarMode.Month)
            {
                calendar1.DisplayMode = CalendarMode.Year;
            }