Loading...
Loading...
Guide for implementing Syncfusion Windows Forms Scheduler (Event Calendar) control for scheduling appointments and event management. Use this skill when implementing calendar functionality, appointment scheduling, or event management in Windows Forms applications. Covers schedule views, recurring appointments, calendar navigation, appointment dragging, and data binding.
npx skill4agent add syncfusion/winforms-ui-components-skills syncfusion-winforms-schedulerscheduleControl1.GetScheduleHost().ThemeChangede.ProposedItemusing System;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Schedule;
namespace SchedulerApp
{
public partial class Form1 : Form
{
private ScheduleControl scheduleControl1;
public Form1()
{
InitializeComponent();
InitializeScheduler();
}
private void InitializeScheduler()
{
// Create ScheduleControl
scheduleControl1 = new ScheduleControl();
scheduleControl1.Location = new Point(20, 20);
scheduleControl1.Size = new Size(800, 600);
// Set up data provider
SimpleScheduleDataProvider data = new SimpleScheduleDataProvider();
data.MasterList = new SimpleScheduleAppointmentList();
data.FileName = "appointments.schedule";
// Configure view and data binding
scheduleControl1.ScheduleType = ScheduleViewType.Month;
scheduleControl1.DataSource = data;
// Add to form
this.Controls.Add(scheduleControl1);
}
}
}// Get the data provider
SimpleScheduleDataProvider dataProvider = scheduleControl1.DataSource as SimpleScheduleDataProvider;
// Create new appointment
IScheduleAppointment appointment = dataProvider.NewScheduleAppointment();
appointment.StartTime = DateTime.Now.AddHours(1);
appointment.EndTime = DateTime.Now.AddHours(2);
appointment.Subject = "Team Meeting";
appointment.Content = "Discuss project milestones";
appointment.LabelValue = 2; // Business category
appointment.ForeColor = Color.Blue;
// Add to data provider
dataProvider.AddItem(appointment);
// Save changes
dataProvider.CommitChanges();// Cast to recurring data provider
IRecurringScheduleDataProvider recurringProvider =
scheduleControl1.DataSource as IRecurringScheduleDataProvider;
// Create recurring appointment
IScheduleAppointment app = recurringProvider.NewScheduleAppointment();
IRecurringScheduleAppointment recurringItem = app as IRecurringScheduleAppointment;
if (recurringItem != null)
{
recurringItem.StartTime = new DateTime(2026, 03, 24, 9, 0, 0);
recurringItem.EndTime = new DateTime(2026, 03, 24, 10, 0, 0);
recurringItem.Subject = "Daily Standup";
// Recurrence rule: Every weekday
recurringItem.RecurrenceRule = "03/24/2026;06/30/2026;Every WEEKDAY";
// Add recurring appointments
recurringProvider.AddNewRecurringAppointments(recurringItem, new DateTime(2026, 12, 31));
}// Switch to Day view
scheduleControl1.ScheduleType = ScheduleViewType.Day;
// Switch to Week view
scheduleControl1.ScheduleType = ScheduleViewType.Week;
// Switch to WorkWeek view (Monday-Friday)
scheduleControl1.ScheduleType = ScheduleViewType.WorkWeek;
// Switch to Month view
scheduleControl1.ScheduleType = ScheduleViewType.Month;// Access appearance object
ScheduleAppearance appearance = scheduleControl1.Appearance;
// Customize colors
appearance.CaptionBackColor = Color.FromArgb(0, 114, 198);
appearance.PrimeTimeCellColor = Color.LightBlue;
appearance.NonPrimeTimeCellColor = Color.White;
// Set prime time hours (9 AM to 5 PM)
appearance.PrimeTimeStart = new TimeSpan(9, 0, 0);
appearance.PrimeTimeEnd = new TimeSpan(17, 0, 0);
// Apply Metro theme
appearance.VisualStyle = Syncfusion.Windows.Forms.GridVisualStyles.Metro;
// Customize navigation calendar
appearance.NavigationCalendarBackColor = Color.White;
appearance.NavigationCalendarSelectionColor = Color.Blue;
appearance.NavigationCalendarTodayColor = Color.Red;// Enable touch mode for swipe, zoom, and pan gestures
scheduleControl1.EnableTouchMode = true;
// Users can now:
// - Swipe vertically to scroll in Day/WorkWeek views
// - Swipe horizontally to navigate previous/next
// - Zoom to change view types (like Outlook)// Subscribe to ItemChanging event
scheduleControl1.ItemChanging += ScheduleControl1_ItemChanging;
private void ScheduleControl1_ItemChanging(object sender, ScheduleAppointmentCancelEventArgs e)
{
if (e.Action == ItemAction.ItemDrag)
{
// Get drag context (Calendar or Schedule area)
Console.WriteLine($"Dropped in: {e.ItemDragHitContext}");
// Cancel drops to calendar area
if (e.ItemDragHitContext == ItemDragHitContext.Calendar)
{
MessageBox.Show("Cannot drop appointments in calendar area");
e.Cancel = true;
}
}
}DataSourceScheduleTypeAppearanceCalendarEnableAlertsEnableTouchModeStartTimeEndTimeSubjectContentAllDayLabelValueMarkerValueReminderValueLocationValueForeColorUniqueIDOwnerGetScheduleForDay(DateTime day)GetSchedule(DateTime start, DateTime end)NewScheduleAppointment()AddItem(IScheduleAppointment)RemoveItem(IScheduleAppointment)CommitChanges()SaveOnCloseBehaviorAction