public List <ChooseTime> GetChooseTimeList() { List <ChooseTime> timeList = new List <ChooseTime>(); DateTime start = this.GetStartDate(); DateTime end = this.GetEndDate(); for (int i = 0; start.AddDays(i) < end; i++) { ChooseTime day = new ChooseTime() { Day = start.AddDays(i).Day.ToString("00"), Parameter = new object[] { start.AddDays(i).ToString("", Thread.CurrentThread.CurrentCulture), this.mCalendarViewModel } }; timeList.Add(day); } ; return(timeList); }
void Calendar_Loaded(object sender, RoutedEventArgs e) { List <ChooseTime> timeList = new List <ChooseTime>(); DateTime start = this.GetStartDate(); DateTime end = this.GetEndDate(); for (int i = 0; start.AddDays(i) < end; i++) { ChooseTime day = new ChooseTime() { Day = start.AddDays(i).Day.ToString("00") }; timeList.Add(day); } ; this.mItemControl.ItemsSource = timeList; this.mCalendarBtn.MouseDown += mCalendarBtn_MouseDown; }