private void cSC_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) { Mouse.Capture(null); Calendar calendar = (Calendar)sender; if (calendar.SelectedDate != null && calendar.Name == "cJanSC" && btnEdit.IsEnabled == false) { Cycle.CleanCycleCalendars(this); Cycle.SetEndCicles(this, (DateTime)calendar.SelectedDate); } }