This is a migrated thread and some comments may be shown as answers.

Keep Text in appointment in view

1 Answer 69 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 02 Apr 2021, 01:33 PM

Hello,

 

I am currently using a Scheduler control in weekview where the range of hours that's visible is about 6 hours.

The appointments are shown in this view but the text is always aligned at the top of the AppointmentElement.

When the top of the AppointmentElement is outside the view, you see only a colored rectangle and it's not clear what appointment is shown

 

Is there a way to

- align the text at the top of the AppointmentElement when the start-time is within the view.

- align the text at the top of the Schedulerview when the start-time is NOT within the view. (the text will be shown somewhere in the middle of the rectange)

 

I have added a picture to clarify my question.

 

Best regards

Patrick Vossen

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 05 Apr 2021, 03:46 PM

Hello, Patrick,

By default, the AppointmentElement text is positioned at TopLeft. Hence, it is normal if you scroll down a long-running appointment the text to be outside the view area. I would suggest you to increase the view area of your RadScheduler, if possible, in order to allow more hours to be visible and appointments to be shown. 

If you want to change the text alignment you can use the AppointmentFormatting event and set AppointmentElement.TextAlignment property to the desired value. If you need to track when the vertical scroll bar changes its value you can use the following approach as an example to achieve your goal:

SchedulerDayViewElement viewElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement;
viewElement.DataAreaElement.VScrollBar.ValueChanged += this.VScrollBar_ValueChanged;

bool updateTextAlignment;

private void VScrollBar_ValueChanged(object sender, EventArgs e)
{
    RadScrollBarElement s = sender as RadScrollBarElement;
    if (s.Value > 5)
    {
        updateTextAlignment = true;
        this.radScheduler1.SchedulerElement.RefreshViewElement();
    }
}

private void RadScheduler1_AppointmentFormatting(object sender, SchedulerAppointmentEventArgs e)
{
    if (updateTextAlignment)
    {
        e.AppointmentElement.TextAlignment = ContentAlignment.MiddleLeft;
    }
}

I hope this information. Let me know if you have any other questions.

Regards,
Nadya
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Scheduler and Reminder
Asked by
Patrick
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or