Hello support team,
the provided solution works fine, but now I have a small problem with small appointment. If the Image is to big to fit into the appointments area, it's overlapping. I tried to avoid this by only enable the image, if the width of the appointment is bigger than my icon.
private void rsTermine_AppointmentFormatting(object sender, SchedulerAppointmentEventArgs e)
{
e.AppointmentElement.ShowAppointmentDescription = true;
e.AppointmentElement.TextAlignment = ContentAlignment.MiddleLeft;
e.AppointmentElement.ForeColor = e.AppointmentElement.BackColor.IdealTextColor();
e.AppointmentElement.Text = ((e.Appointment.Start.Date == e.Appointment.End.Date) || ((e.Appointment.Start.Date.AddDays(1) == e.Appointment.End.Date) && (e.Appointment.End == e.Appointment.End.Date)))
? $"{e.Appointment.Start:t} - {e.Appointment.End:t} <
b
>{e.Appointment.Summary}</
b
>"
: $"{e.Appointment.Start:g} - {e.Appointment.End:g} <
b
>{e.Appointment.Summary}</
b
>";
e.AppointmentElement.TextWrap = true;
e.AppointmentElement.AutoEllipsis = true; ;
if (e.Appointment.DataItem is IDispositionTermin termin)
{
var width = termin.CalendarSymbol?.Width;
e.AppointmentElement.AppointmentIcon = (width.HasValue && e.AppointmentElement.Size.Width > width.Value)
? termin.CalendarSymbol
: null;
//e.AppointmentElement.AppointmentIcon = termin.CalendarSymbol;
e.AppointmentElement.ToolTipText = termin.TooltipText;
}
}
But now my icon is not shown until I select a appointment, than all appointments get refreshed immediately. This happens because on first appointment formatting event the size is (0, 0). I use this code to refresh the scheduler, but this doesn't work for the appointments.
public void RefreshScheduler()
{
rsTermine.Refresh();
rsTermine.SchedulerElement.RefreshViewElement();
//RefreshViewElement erzeugt eine neues Viewelement, daher müssen einige Properties ggf. neu gesetzt werden
if (rsTermine.SchedulerElement.ViewElement is TimelineGroupingByResourcesElement timelineElement)
{
timelineElement.ResourceHeaderWidth = 150;
}
}
How do I trigger a Refresh of the appointments?
Regards,
Stephan