Currently,
I’m using the Radscheduler MultiDayView to create a “two week” view in which
the end user has the possibility to choose if he wants to see weekend days or
not.
When this
view is used in combination with appointments spanning multiple days and the display
of the weekend days, every thing works fine (with_weekend.png). The appointment
starts at 06/21/19 05:00 and ends 06/24/19 21:05.
However, if
weekend days are not shown in this view (without_weekend.png), part of the same
appointment is shown on 06/25/19 and the end time on 06/24/19 is also incorrect.
How can I solve this? It is not an option to show it as an “All day appointment” since the customer wants to know the exact start and end time.
public
RadForm1()
{
InitializeComponent();
this
.radScheduler1.ActiveViewType = SchedulerViewType.MultiDay;
Appointment a =
new
Appointment(
new
DateTime(2019, 6, 21, 5, 0, 0),
new
DateTime(2019, 6, 24, 21, 05, 0),
"Test"
);
a.AllDay =
false
;
this
.radScheduler1.Appointments.Add(a);
int
daysDuration = 2;
SchedulerMultiDayView multiDayView =
new
SchedulerMultiDayView();
multiDayView.ShowAllDayArea =
false
;
DateTime startDate =
new
DateTime(2019, 6, 20);
multiDayView.Intervals.Add(startDate, daysDuration);
multiDayView.Intervals.Add(startDate.AddDays(4), daysDuration * 2);
this
.radScheduler1.ActiveView = multiDayView;
}
I have logged it in our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.
I have also updated your Telerik points.
Currently, the possible solution that I can suggest is to handle the AppointmentFormatting event and hide the visual AppointmentElements which interval is not included into the view:
SchedulerMultiDayView multiDayView =
new
SchedulerMultiDayView();
public
RadForm1()
{
InitializeComponent();
new
RadControlSpyForm().Show();
this
.radScheduler1.AppointmentFormatting += radScheduler1_AppointmentFormatting;
this
.radScheduler1.ActiveViewType = SchedulerViewType.MultiDay;
Appointment a =
new
Appointment(
new
DateTime(2019, 6, 21, 5, 0, 0),
new
DateTime(2019, 6, 24, 21, 05, 0),
"Test"
);
a.AllDay =
false
;
this
.radScheduler1.Appointments.Add(a);
int
daysDuration = 2;
multiDayView.ShowAllDayArea =
false
;
DateTime startDate =
new
DateTime(2019, 6, 20);
multiDayView.Intervals.Add(startDate, daysDuration);
multiDayView.Intervals.Add(startDate.AddDays(4), daysDuration * 2);
this
.radScheduler1.ActiveView = multiDayView;
}
private
void
radScheduler1_AppointmentFormatting(
object
sender, SchedulerAppointmentEventArgs e)
{
e.AppointmentElement.Visibility = ElementVisibility.Collapsed;
foreach
(DateTimeInterval interval
in
multiDayView.Intervals)
{
if
(interval.Contains(e.AppointmentElement.Start) && interval.Contains(e.AppointmentElement.End))
{
e.AppointmentElement.Visibility = ElementVisibility.Visible;
break
;
}
}
}
The attached gif file illustrates the achieved result.
Hello Dess,
I have modified the sample project. If you run it now, you will see that unticking the “Show Weekend” in the RadSchedulerNavigator will make the appointment visually last until Wednesday 26th.
To achieve this behaviour, I subscribed to the ShowWeekendStateChanged event of the RadSchedulerNavigator. I have written some specific code in adSchedulerNavigator1_ShowWeekendStateChanged to be able to have the option to show/hide the weekend in MultiDayView.
I hope this code is useful for you.