0

所以,我正在尝试制作一个 wpf 日历,但是 GetValue() 和 SetValue() 方法有问题。我已经声明了所有库,它告诉我这些方法根本不存在并且无法识别它们。

    using System;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Windows;
    using System.Windows.Controls;
    using System.Reflection;


    namespace CustomControls
    {
       public class Calendar : Control
        {
            public ObservableCollection<Day> Days { get; set; }
            public ObservableCollection<string> DayNames { get; set; }
            public static readonly DependencyProperty CurrentDateProperty = DependencyProperty.Register("CurrentDate", typeof (DateTime), typeof (Calendar));

            public event EventHandler<DayChangedEventArgs> DayChanged;

            public DateTime CurrentDate
            {
                get { return (DateTime) GetValue(CurrentDateProperty); }
                set { SetValue(CurrentDateProperty, value); }
            }
        }
}

我希望你能帮助我,并提前谢谢你!

4

0 回答 0