Quantcast
Viewing all articles
Browse latest Browse all 1954

Present Schedules at a Glance with the New WinForms Scheduler Agenda View

In this post, learn more about the Scheduler control in Telerik UI for WinForms and how to use the new Agenda view that was added in the latest R3’18 release.

RadScheduler in Telerik UI for WinForms is a highly customizable component for presenting a variety of schedules with appointments in different views such as Day, Week, Month and more. With the new Agenda view the appointments are displayed in a table, structured like a simple list for a specific period of time.

Image may be NSFW.
Clik here to view.
new_AgendaView

Note that each Appointment represents a separate row. Unlike the other available views in the RadScheduler, the Agenda View doesn’t have empty rows/cells representing time slots since days with no appointments are not shown. This makes it quite easy to glance at a certain schedule in a very concise fashion.

Of course, all CRUD operations are supported out of the box - for example inserting and editing, and you can delete simply by pressing the Delete key when a certain appointment is selected.

Set the Agenda View

To use the new Agenda View, simply set the ActiveViewType property to SchedulerViewType.Agenda. That's it, a single property and the control will take care of the rest and display all the appointments respectively.

this.radScheduler1.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Agenda;

Specify How Many Days Are Visible in the Agenda

The specific period of time is defined by the DayCount property of the SchedulerAgendaView

SchedulerAgendaView agendaView = this.radScheduler1.GetAgendaView(); 
agendaView.DayCount = 2;

Group by Resources

SchedulerAgendaView internally uses a RadGridView to display the available records. It can be accessed through the SchedulerAgendaViewElement.Grid property. Feel free to use the whole API that RadGridView offers to achieve any custom requirements that you have. You can add/remove resources using the RadScheduler’s Resources collection. The resources are represented by the Resource class and you can assign it text, color and image values. Since SchedulerAgendaView uses a RadGridView, it supports grouping by different columns. You can drag any of the grid's header cells and drop it onto the group panel. Alternatively, you can use the following code snippet:

GroupDescriptor descriptor = newGroupDescriptor();
descriptor.GroupNames.Add("Resource", ListSortDirection.Ascending);
agendaViewElement.Grid.GroupDescriptors.Add(descriptor);

Image may be NSFW.
Clik here to view.
grouped_Agenda

Format Appointments with the Resource’s Color

By default, only the resource’s group row is formatted with the Resource.Color property. However, you can handle the SchedulerAgendaViewElement.Grid.CellFormatting event and customize the cells:

Image may be NSFW.
Clik here to view.
grouped_Agenda_Formatted

SchedulerAgendaViewElement agendaViewElement = this.radScheduler1.SchedulerElement.ViewElement asSchedulerAgendaViewElement;
agendaViewElement.Grid.CellFormatting += Grid_CellFormatting;

privatevoidGrid_CellFormatting(objectsender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    if(e.Row isGridViewDataRowInfo)
    {
        AgendaAppointmentWrapper wrapper = e.Row.DataBoundItem asAgendaAppointmentWrapper;
        if(wrapper != null&& wrapper.Resource != string.Empty)
        {
            e.CellElement.BackColor = GetColorByResources(wrapper.Resource);
            e.CellElement.DrawFill = true;
            e.CellElement.GradientStyle = GradientStyles.Solid;
        }
        else
        {
            e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
        }
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
    }
}

Try It Out and Share Your Feedback

RadScheduler is a part of the Telerik UI for WinForms suite. You can learn more about it via the product page, and comes with a 30-day free trial to give you time to explore the toolkit and consider using it for your current or upcoming WinForms development.

Lastly, we would love to hear what you think, so should you have any questions and/or comments, please share them in our Feedback Portal or in the comment section below.

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 1954

Trending Articles