public void BuildDateBoxes() { DateTime currentDate = DateTime.Now; DateTime date = (currentDate.DayOfWeek == DayOfWeek.Sunday) ? (currentDate.AddDays(-6)) : (currentDate.AddDays(-((int)currentDate.DayOfWeek - 1))); int row = 2; int col = 1; int day = 0; while (day < 5) { DateBox dBox = new DateBox(date.AddDays(day)); CalendarGrid.Children.Add(dBox); Grid.SetColumn(dBox, col); Grid.SetRow(dBox, row); day++; col++; DateBoxes.Add(dBox); } }
public void ClearDateBoxes() { DateBoxes.ForEach(x => x.TxtBox.Text = ""); }