Appointment as solid green bar?

6 posts, 1 answers
  1. Lou
    Lou avatar
    61 posts
    Member since:
    Aug 2014

    Posted 22 Oct 2014 Link to this post

    Hi,

    Is there a way to make an appointment on the calendar appear as a simple solid green bar (rectangle)?

    The rectangle needs to start exactly at the event start time and end at the end time and ideally be without any type of fancy shading/background (just a plain rectangle). Ideally, the width of the rectangle would cover the whole width of the cell (assuming no other appointments overlapping the same time period).

    Thanks,

    -Lou
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 23 Oct 2014 Link to this post

    Hi Lou,

    Thank you for writing.

    You can use the AppontmentFormatting event to change the appearance of the AppointmentElements:
    void radScheduler1_AppointmentFormatting(object sender, SchedulerAppointmentEventArgs e)
    {
        e.AppointmentElement.DrawFill = true;
        e.AppointmentElement.BackColor = Color.Green;
        e.AppointmentElement.GradientStyle = GradientStyles.Solid;
    }

    More information about this event can be found here: http://www.telerik.com/help/winforms/scheduler-appearance-formatting-appointments.html.

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Lou
    Lou avatar
    61 posts
    Member since:
    Aug 2014

    Posted 23 Oct 2014 in reply to Stefan Link to this post

    Thanks Stefan, I will try this.
  5. Lou
    Lou avatar
    61 posts
    Member since:
    Aug 2014

    Posted 23 Oct 2014 Link to this post

    Hi,

    I am close to what I need but not quite there yet, I could use a little more help if possible.

    I now have the following settings for the appointmentElement:
     
        appointmentElement.DrawFill = True
        appointmentElement.BackColor = Color.Green
        appointmentElement.GradientStyle = GradientStyles.Solid
        appointmentElement.BorderWidth = 0
        appointmentElement.Padding = New Padding(0)
        appointmentElement.Margin = New Padding(0)

    This is quite close to what I need except for the following (see screen shot)

    1. There is a white/blue border on the left hand side next to the green bar.
    2. The bar doesn't *quite* come to the end time. It's just before the end time (which is 8am). Can I make it come all the way to 8am?
    3. The bar needs to be the same width as the column (fill the entire horizontal space for the day, or as much as possible).

    How can I fix this? Thanks again for the help.

    -Lou

  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 28 Oct 2014 Link to this post

    Hi Lou,

    Thank you for writing back.

    Straight to your questions:

    1. The line you are referring to is the status of the appointment. By setting the UseDefaultPaint to true will not draw it.
    2. I believe this is handled by the above setting as well. If not, you can have a look at the exact time rendering functionality.
    3. This can be regulated via the AppointmentMargin property of the view element. A suitable place to introduce this setting is the ActiveViewChanged event.

    Here is a code snippet of the changes:
    Private Sub radScheduler1_ActiveViewChanged(sender As Object, e As SchedulerViewChangedEventArgs)
        If TypeOf e.NewView Is SchedulerWeekView Then
            TryCast(radScheduler1.ViewElement, SchedulerDayViewElement).AppointmentMargin = New Padding(0)
        End If
    End Sub
     
    Private Sub radScheduler1_AppointmentFormatting(sender As Object, e As SchedulerAppointmentEventArgs)
        e.AppointmentElement.DrawFill = True
        e.AppointmentElement.BackColor = Color.Green
        e.AppointmentElement.GradientStyle = GradientStyles.Solid
        e.AppointmentElement.BorderWidth = 0
        e.AppointmentElement.UseDefaultPaint = True
    End Sub

    I hope that you find this information useful.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Lou
    Lou avatar
    61 posts
    Member since:
    Aug 2014

    Posted 28 Oct 2014 Link to this post

    Hi Stefan, thanks for the response I will try your suggestions.

    -Lou
Back to Top
UI for WinForms is Visual Studio 2017 Ready