Appointment width

2 posts, 1 answers
  1. Franco
    Franco avatar
    27 posts
    Member since:
    Apr 2010

    Posted 21 Mar 2011 Link to this post

    Good morning.
    Is it possible to set the width of an appointment? My problem is to leave a space on the right of existing appointments to make it easy to select cells for creating a new appointment.
    Thank you
    Gianfranco Pesenato
  2. Answer
    Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 23 Mar 2011 Link to this post

    Hi Franco,

    You can set a margin to the appointment element in order to leave space on the right. To do so, you
    have two options. The first one is to edit the theme you are using and set the AppointmentMargin properties of all views of the RadScheduler. General help on using Visual Style Builder can be found here.
    I have attached some screenshots which show where you can find the AppointmentMargin property.

    The second option is to subscribe to the ActiveViewChanged event and set the AppointmentMargin property. Here is a code snippet that demonstrates this:

    public Form1()
    {
        InitializeComponent();
        radScheduler1.ActiveViewChanged += new EventHandler<SchedulerViewChangedEventArgs>(radScheduler1_ActiveViewChanged);
        SetAppointmentsMargin();
    }
     
    void radScheduler1_ActiveViewChanged(object sender, SchedulerViewChangedEventArgs e)
    {
        SetAppointmentsMargin();
    }
     
    void SetAppointmentsMargin()
    {
        SchedulerTimelineViewElement timelineElement = (radScheduler1.SchedulerElement.ViewElement as SchedulerTimelineViewElement);
     
        if (timelineElement != null)
        {
            timelineElement.AppointmentMargin = new Padding(3, 0, 30, 0);
            return;
        }
     
        SchedulerDayViewElement dayviewElement = (radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement);
     
        if (dayviewElement != null)
        {
            dayviewElement.AppointmentMargin = new Padding(3, 0, 30, 0);
            return;
        }
     
        SchedulerMonthViewElement monthviewElement = (radScheduler1.SchedulerElement.ViewElement as SchedulerMonthViewElement);
     
        if (monthviewElement != null)
        {
            monthviewElement.AppointmentMargin = new Padding(3, 0, 30, 0);
            return;
        }
    }

    I hope this helps. Feel free to ask if you have any other questions.

    Greetings,
    Ivan Todorov
    the Telerik team
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top