Hello Telerik-Team,
I'm trying to format appointments in the timelineview of the scheduler. The following code works, but it doesn't look the way I want.
private
void
rsTermine_AppointmentFormatting(
object
sender, SchedulerAppointmentEventArgs e)
{
e.AppointmentElement.ShowAppointmentDescription =
true
;
e.AppointmentElement.TextAlignment = ContentAlignment.MiddleCenter;
e.AppointmentElement.ForeColor = e.AppointmentElement.BackColor.IdealTextColor();
e.AppointmentElement.Text = e.Appointment.Start.Date == 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)
{
e.AppointmentElement.Image = termin.CalendarSymbol;
e.AppointmentElement.ImageAlignment = ContentAlignment.MiddleLeft;
e.AppointmentElement.ImageLayout = ImageLayout.None;
e.AppointmentElement.TextImageRelation = TextImageRelation.ImageBeforeText;
e.AppointmentElement.ToolTipText = termin.TooltipText;
//e.AppointmentElement.Padding = new Padding(5, 1, 2, 1);
}
}
I want to align both, text and image left with a bit padding on the left side and the image before the text. The appointment should look this way: < padding | image | text >. Have you any suggestions to improve the code?
Greetings from Germany,
Stephan