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.
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 Delete when a certain appointment is selected.
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;
The specific period of time is defined by the DayCount
property of the SchedulerAgendaView
:
SchedulerAgendaView agendaView = this.radScheduler1.GetAgendaView();
agendaView.DayCount = 2;
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 = new GroupDescriptor();
descriptor.GroupNames.Add("Resource", ListSortDirection.Ascending);
agendaViewElement.Grid.GroupDescriptors.Add(descriptor);
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:
SchedulerAgendaViewElement agendaViewElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerAgendaViewElement;
agendaViewElement.Grid.CellFormatting += Grid_CellFormatting;
private void Grid_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
if (e.Row is GridViewDataRowInfo)
{
AgendaAppointmentWrapper wrapper = e.Row.DataBoundItem as AgendaAppointmentWrapper;
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);
}
}
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.
Desislava Yordanova is a proactive ambassador of diligent processes and a customer-caring professional. Currently, she is a Technical Support Engineer, Principal in the Document Processing team after a successful journey in the Telerik UI for WinForms team. She joined the company in 2013. Desislava holds a master’s degree in Computer Systems and Technologies from the Technical University in Sofia. Apart from her job, she is keen on snowboarding and travelling. You can find Desislava on LinkedIn.