private void btn_CustomDateSearch(object sender, RoutedEventArgs e) { DateTime tempFromDate = (DateTime)dp_from.SelectedDate; DateTime tempToDate = (DateTime)dp_to.SelectedDate; DateTime fromDate = Convert.ToDateTime(tempFromDate.ToShortDateString() + " 12:00:00 AM"); DateTime toDate = Convert.ToDateTime(tempToDate.ToShortDateString() + " 11:59:59 PM"); dg_DSR.ItemsSource = null; dg_DSR.ItemsSource = SaleItem.getAllMappedToFoodITemViewModelForDSRByDate(fromDate, toDate); }