private void DateLoan_Click(object sender, RoutedEventArgs e)// { if (lStartBox.SelectedDate != null && lEndBox.SelectedDate != null && lStartBox.SelectedDate < lEndBox.SelectedDate) { var now = DateTime.Now; loanList.ItemsSource = null; loanList.ItemsSource = lo.DateLoan(lStartBox.SelectedDate ?? now, lEndBox.SelectedDate ?? now, choiceLoan.SelectedItem as string); } else { MessageBox.Show("Please select a correct arbitrary period"); } }