Fix FetchNewAppointments logic to return appointments for all visible dates instead for only one month

This commit is contained in:
ni4ka7a 2018-11-09 15:22:11 +02:00
Родитель f4fb8451cb
Коммит 3f97b936bd
1 изменённых файлов: 27 добавлений и 14 удалений

Просмотреть файл

@ -3069,20 +3069,33 @@ namespace Telerik.UI.Xaml.Controls.Input
this.defaultHighlightedCellStyle = (CalendarCellStyle)RadCalendar.MultiDayViewResources[DefaultHighlightedCellStyleName];
}
}
}
private void FetchNewAppointments()
{
if (this.AppointmentSource != null && this.IsTemplateApplied)
{
DateTime startDate = GetFirstDayofMonth(this.DisplayDate, this.currentCulture.Calendar);
ObservableCollection<IAppointment> fetchedAppointments = this.AppointmentSource.FetchData(startDate, startDate.Month == DateTime.MaxValue.Month && startDate.Year == DateTime.MaxValue.Year ? startDate : startDate.AddMonths(1));
this.AppointmentSource.AllAppointments.Clear();
foreach (IAppointment app in fetchedAppointments)
{
this.AppointmentSource.AllAppointments.Add(app);
}
}
}
private void FetchNewAppointments()
{
if (this.AppointmentSource != null)
{
var rowCount = this.model.RowCount;
int columnCount;
if (this.DisplayMode == CalendarDisplayMode.MultiDayView)
{
columnCount = 3 * this.MultiDayViewSettings.VisibleDays;
}
else
{
columnCount = this.model.ColumnCount;
}
DateTime startDate = this.model.GetFirstDateToRenderForDisplayMode(this.DisplayDate, this.DisplayMode);
DateTime endDate = startDate.AddDays(rowCount * columnCount);
ObservableCollection<IAppointment> fetchedAppointments = this.AppointmentSource.FetchData(startDate, startDate.Month == DateTime.MaxValue.Month && startDate.Year == DateTime.MaxValue.Year ? startDate : endDate);
this.AppointmentSource.AllAppointments.Clear();
foreach (IAppointment app in fetchedAppointments)
{
this.AppointmentSource.AllAppointments.Add(app);
}
}
}
private void AddLayer(CalendarLayer layer, Panel parent)