Loading...
Loading...
Compare original and translation side by side
<Window xmlns:syncfusion="http://schemas.syncfusion.com/wpf">
<syncfusion:SfScheduler x:Name="Schedule"
ViewType="Week"
FirstDayOfWeek="Sunday" />
</Window>using Syncfusion.UI.Xaml.Scheduler;
public MainWindow()
{
InitializeComponent();
// Create appointment collection
var appointments = new ScheduleAppointmentCollection();
// Add sample appointment
appointments.Add(new ScheduleAppointment
{
StartTime = DateTime.Now.Date.AddHours(10),
EndTime = DateTime.Now.Date.AddHours(12),
Subject = "Client Meeting",
Location = "Conference Room A",
Notes = "Discuss project timeline",
AppointmentBackground = Brushes.LightBlue
});
Schedule.ItemsSource = appointments;
}<Window xmlns:syncfusion="http://schemas.syncfusion.com/wpf">
<syncfusion:SfScheduler x:Name="Schedule"
ViewType="Week"
FirstDayOfWeek="Sunday" />
</Window>using Syncfusion.UI.Xaml.Scheduler;
public MainWindow()
{
InitializeComponent();
// 创建预约集合
var appointments = new ScheduleAppointmentCollection();
// 添加示例预约
appointments.Add(new ScheduleAppointment
{
StartTime = DateTime.Now.Date.AddHours(10),
EndTime = DateTime.Now.Date.AddHours(12),
Subject = "客户会议",
Location = "A会议室",
Notes = "讨论项目时间线",
AppointmentBackground = Brushes.LightBlue
});
Schedule.ItemsSource = appointments;
}// Custom business object
public class Meeting : INotifyPropertyChanged
{
public string EventName { get; set; }
public DateTime From { get; set; }
public DateTime To { get; set; }
public Brush Color { get; set; }
public bool IsAllDay { get; set; }
}
// ViewModel
public class SchedulerViewModel
{
public ObservableCollection<Meeting> Events { get; set; }
public SchedulerViewModel()
{
Events = new ObservableCollection<Meeting>
{
new Meeting
{
EventName = "Team Standup",
From = DateTime.Now.Date.AddHours(9),
To = DateTime.Now.Date.AddHours(9.5),
Color = Brushes.Green,
IsAllDay = false
}
};
}
}<syncfusion:SfScheduler x:Name="Schedule"
ViewType="Week"
ItemsSource="{Binding Events}">
<syncfusion:SfScheduler.AppointmentMapping>
<syncfusion:AppointmentMapping
Subject="EventName"
StartTime="From"
EndTime="To"
AppointmentBackground="Color"
IsAllDay="IsAllDay" />
</syncfusion:SfScheduler.AppointmentMapping>
</syncfusion:SfScheduler>// 自定义业务对象
public class Meeting : INotifyPropertyChanged
{
public string EventName { get; set; }
public DateTime From { get; set; }
public DateTime To { get; set; }
public Brush Color { get; set; }
public bool IsAllDay { get; set; }
}
// 视图模型
public class SchedulerViewModel
{
public ObservableCollection<Meeting> Events { get; set; }
public SchedulerViewModel()
{
Events = new ObservableCollection<Meeting>
{
new Meeting
{
EventName = "团队站会",
From = DateTime.Now.Date.AddHours(9),
To = DateTime.Now.Date.AddHours(9.5),
Color = Brushes.Green,
IsAllDay = false
}
};
}
}<syncfusion:SfScheduler x:Name="Schedule"
ViewType="Week"
ItemsSource="{Binding Events}">
<syncfusion:SfScheduler.AppointmentMapping>
<syncfusion:AppointmentMapping
Subject="EventName"
StartTime="From"
EndTime="To"
AppointmentBackground="Color"
IsAllDay="IsAllDay" />
</syncfusion:SfScheduler.AppointmentMapping>
</syncfusion:SfScheduler>var recurringMeeting = new ScheduleAppointment
{
StartTime = new DateTime(2026, 3, 24, 14, 0, 0), // Monday 2PM
EndTime = new DateTime(2026, 3, 24, 15, 0, 0),
Subject = "Weekly Status Meeting",
// Recur every Monday for 12 weeks
RecurrenceRule = "FREQ=WEEKLY;BYDAY=MO;COUNT=12",
AppointmentBackground = Brushes.Orange
};var recurringMeeting = new ScheduleAppointment
{
StartTime = new DateTime(2026, 3, 24, 14, 0, 0), // 周一14点
EndTime = new DateTime(2026, 3, 24, 15, 0, 0),
Subject = "每周状态会议",
// 每周一重复,共12周
RecurrenceRule = "FREQ=WEEKLY;BYDAY=MO;COUNT=12",
AppointmentBackground = Brushes.Orange
};// Add resources
Schedule.ResourceCollection = new ObservableCollection<SchedulerResource>
{
new SchedulerResource { Id = "1001", Name = "Dr. Smith", Background = Brushes.Blue },
new SchedulerResource { Id = "1002", Name = "Dr. Jones", Background = Brushes.Green }
};
Schedule.ResourceGroupType = ResourceGroupType.Resource;
// Assign appointment to resource
var appointment = new ScheduleAppointment
{
StartTime = DateTime.Now.AddHours(2),
EndTime = DateTime.Now.AddHours(3),
Subject = "Patient Consultation",
ResourceIdCollection = new ObservableCollection<object> { "1001" }
};// 添加资源
Schedule.ResourceCollection = new ObservableCollection<SchedulerResource>
{
new SchedulerResource { Id = "1001", Name = "Smith医生", Background = Brushes.Blue },
new SchedulerResource { Id = "1002", Name = "Jones医生", Background = Brushes.Green }
};
Schedule.ResourceGroupType = ResourceGroupType.Resource;
// 为资源分配预约
var appointment = new ScheduleAppointment
{
StartTime = DateTime.Now.AddHours(2),
EndTime = DateTime.Now.AddHours(3),
Subject = "患者咨询",
ResourceIdCollection = new ObservableCollection<object> { "1001" }
};var globalMeeting = new ScheduleAppointment
{
StartTime = new DateTime(2026, 3, 25, 10, 0, 0),
EndTime = new DateTime(2026, 3, 25, 11, 0, 0),
Subject = "Global Team Sync",
StartTimeZone = "Pacific Standard Time",
EndTimeZone = "Pacific Standard Time"
};
// Scheduler displays in local timezone automatically
Schedule.TimeZone = TimeZoneInfo.Local.Id;var globalMeeting = new ScheduleAppointment
{
StartTime = new DateTime(2026, 3, 25, 10, 0, 0),
EndTime = new DateTime(2026, 3, 25, 11, 0, 0),
Subject = "全球团队同步会议",
StartTimeZone = "Pacific Standard Time",
EndTimeZone = "Pacific Standard Time"
};
// 调度器自动以本地时区显示
Schedule.TimeZone = TimeZoneInfo.Local.Id;| Property | Type | Description | Default |
|---|---|---|---|
| ViewType | SchedulerViewType | Sets the view (Day, Week, WorkWeek, Month, TimelineDay, TimelineWeek, TimelineWorkWeek, TimelineMonth) | Month |
| ItemsSource | IEnumerable | Appointment collection to display | null |
| DisplayDate | DateTime | Currently displayed date | DateTime.Now |
| SelectedDate | DateTime | Currently selected date | DateTime.Now |
| FirstDayOfWeek | DayOfWeek | Starting day of the week | Sunday |
| TimeZone | string | Scheduler's timezone identifier | Local |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| ViewType | SchedulerViewType | 设置日历视图类型(Day、Week、WorkWeek、Month、TimelineDay、TimelineWeek、TimelineWorkWeek、TimelineMonth) | Month |
| ItemsSource | IEnumerable | 要显示的预约集合 | null |
| DisplayDate | DateTime | 当前显示的日期 | DateTime.Now |
| SelectedDate | DateTime | 当前选中的日期 | DateTime.Now |
| FirstDayOfWeek | DayOfWeek | 一周的起始日 | Sunday |
| TimeZone | string | 调度器的时区标识符 | Local |
| Property | Type | Description | Default |
|---|---|---|---|
| AllowedViewTypes | SchedulerViewType | Allowed view types for navigation | All |
| AllowViewNavigation | bool | Enable/disable view navigation | true |
| ShowDatePickerButton | bool | Show date picker button in header | true |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| AllowedViewTypes | SchedulerViewType | 允许导航的视图类型 | 全部 |
| AllowViewNavigation | bool | 启用/禁用视图导航 | true |
| ShowDatePickerButton | bool | 在头部显示日期选择按钮 | true |
| Property | Type | Description | Default |
|---|---|---|---|
| MinimumDate | DateTime | Minimum date that can be displayed | DateTime.MinValue |
| MaximumDate | DateTime | Maximum date that can be displayed | DateTime.MaxValue |
| BlackoutDates | ObservableCollection<DateTime> | Dates where interaction is disabled (TimelineMonth only) | null |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| MinimumDate | DateTime | 可显示的最小日期 | DateTime.MinValue |
| MaximumDate | DateTime | 可显示的最大日期 | DateTime.MaxValue |
| BlackoutDates | ObservableCollection<DateTime> | 禁用交互的日期(仅TimelineMonth视图支持) | null |
| Property | Type | Description | Default |
|---|---|---|---|
| AppointmentMapping | AppointmentMapping | Maps custom objects to ScheduleAppointment properties | null |
| ResourceMapping | ResourceMapping | Maps custom objects to SchedulerResource properties | null |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| AppointmentMapping | AppointmentMapping | 将自定义对象映射到ScheduleAppointment属性 | null |
| ResourceMapping | ResourceMapping | 将自定义对象映射到SchedulerResource属性 | null |
| Property | Type | Description | Default |
|---|---|---|---|
| HeaderHeight | double | Height of the scheduler header | 50 |
| HeaderDateFormat | string | Date format string in header | "MMMM yyyy" |
| HeaderTemplate | DataTemplate | Custom template for header | null |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| HeaderHeight | double | 调度器头部高度 | 50 |
| HeaderDateFormat | string | 头部日期格式字符串 | "MMMM yyyy" |
| HeaderTemplate | DataTemplate | 自定义头部模板 | null |
| Property | Type | Description | Default |
|---|---|---|---|
| ResourceCollection | ObservableCollection<SchedulerResource> | Collection of scheduler resources | null |
| ResourceGroupType | ResourceGroupType | Grouping mode (Resource, Date, None) | None |
| ResourceHeaderTemplate | DataTemplate | Custom template for resource headers | null |
| ResourceHeaderTemplateSelector | DataTemplateSelector | Template selector for resource headers | null |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| ResourceCollection | ObservableCollection<SchedulerResource> | 调度器资源集合 | null |
| ResourceGroupType | ResourceGroupType | 分组模式(Resource、Date、None) | None |
| ResourceHeaderTemplate | DataTemplate | 自定义资源头部模板 | null |
| ResourceHeaderTemplateSelector | DataTemplateSelector | 资源头部模板选择器 | null |
| Property | Type | Description | Default |
|---|---|---|---|
| DaysViewSettings | DaysViewSettings | Settings for Day/Week/WorkWeek views | Default |
| MonthViewSettings | MonthViewSettings | Settings for Month view | Default |
| TimelineViewSettings | TimelineViewSettings | Settings for Timeline views | Default |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| DaysViewSettings | DaysViewSettings | Day/Week/WorkWeek视图设置 | 默认值 |
| MonthViewSettings | MonthViewSettings | Month视图设置 | 默认值 |
| TimelineViewSettings | TimelineViewSettings | 时间线视图设置 | 默认值 |
| Property | Type | Description | Default |
|---|---|---|---|
| CalendarIdentifier | string | Calendar system identifier (Gregorian, etc.) | Gregorian |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| CalendarIdentifier | string | 日历系统标识符(如公历) | Gregorian |
| Property | Type | Description | Default |
|---|---|---|---|
| ShowBusyIndicator | bool | Shows loading indicator during operations | false |
| EnableToolTip | bool | Enable tooltips on appointments | true |
| ToolTipTemplate | DataTemplate | Custom template for tooltips | null |
| EnableReminder | bool | Enable reminder functionality | false |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| ShowBusyIndicator | bool | 操作期间显示加载指示器 | false |
| EnableToolTip | bool | 启用预约工具提示 | true |
| ToolTipTemplate | DataTemplate | 自定义工具提示模板 | null |
| EnableReminder | bool | 启用提醒功能 | false |
| Property | Type | Description | Default |
|---|---|---|---|
| AppointmentContextMenu | ContextMenu | Context menu for appointments | Default |
| CellContextMenu | ContextMenu | Context menu for cells | Default |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| AppointmentContextMenu | ContextMenu | 预约上下文菜单 | 默认值 |
| CellContextMenu | ContextMenu | 单元格上下文菜单 | 默认值 |
| Property | Type | Description | Default |
|---|---|---|---|
| DragDropSettings | DragDropSettings | Configure drag-drop behavior | Default |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| DragDropSettings | DragDropSettings | 配置拖放行为 | 默认值 |
| Property | Type | Description | Default |
|---|---|---|---|
| AppointmentEditFlag | AppointmentEditFlag | Controls which edit operations are allowed | All |
| AppointmentResizeController | IAppointmentResizeController | Custom resize behavior controller | null |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| AppointmentEditFlag | AppointmentEditFlag | 控制允许的编辑操作 | 全部 |
| AppointmentResizeController | IAppointmentResizeController | 自定义调整大小行为控制器 | null |
| Property | Type | Description | Default |
|---|---|---|---|
| LoadOnDemandCommand | ICommand | Command executed when loading appointments on demand | null |
| 属性 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| LoadOnDemandCommand | ICommand | 按需加载预约时执行的命令 | null |
| Method | Description |
|---|---|
| Forward() | Navigate forward by one view interval |
| Backward() | Navigate backward by one view interval |
| SchedulerDateToPoint(DateTime) | Convert date to screen coordinates |
| PointToSchedulerDate(Point) | Convert screen coordinates to date/time |
| 方法 | 描述 |
|---|---|
| Forward() | 按一个视图间隔向前导航 |
| Backward() | 按一个视图间隔向后导航 |
| SchedulerDateToPoint(DateTime) | 将日期转换为屏幕坐标 |
| PointToSchedulerDate(Point) | 将屏幕坐标转换为日期/时间 |
| Event | Description |
|---|---|
| ViewChanged | Raised when the view type changes |
| DisplayDateChanged | Raised when the display date changes |
| SelectionChanged | Raised when the selected date/appointment changes |
| CellTapped | Raised when a cell is tapped/clicked |
| CellDoubleTapped | Raised when a cell is double-clicked |
| CellLongPressed | Raised when a cell is long-pressed |
| AppointmentTapped | Raised when an appointment is tapped/clicked |
| AppointmentDoubleTapped | Raised when an appointment is double-clicked |
| AppointmentDragStarting | Raised when appointment drag begins (can be cancelled) |
| AppointmentDragOver | Raised while dragging appointment over scheduler |
| AppointmentDrop | Raised when appointment is dropped |
| AppointmentResizeStarting | Raised when appointment resize begins (can be cancelled) |
| AppointmentResizing | Raised while appointment is being resized |
| AppointmentResizeCompleted | Raised when appointment resize completes |
| AppointmentEditorOpening | Raised when appointment editor is opening (can be cancelled) |
| AppointmentEditorClosing | Raised when appointment editor is closing (can be cancelled) |
| HeaderTapped | Raised when header is tapped/clicked |
| 事件 | 描述 |
|---|---|
| ViewChanged | 视图类型变更时触发 |
| DisplayDateChanged | 显示日期变更时触发 |
| SelectionChanged | 选中日期/预约变更时触发 |
| CellTapped | 单元格被点击/轻触时触发 |
| CellDoubleTapped | 单元格被双击时触发 |
| CellLongPressed | 单元格被长按触发 |
| AppointmentTapped | 预约被点击/轻触时触发 |
| AppointmentDoubleTapped | 预约被双击时触发 |
| AppointmentDragStarting | 预约开始拖放时触发(可取消) |
| AppointmentDragOver | 预约拖放经过调度器时触发 |
| AppointmentDrop | 预约完成拖放时触发 |
| AppointmentResizeStarting | 预约开始调整大小时触发(可取消) |
| AppointmentResizing | 预约调整大小过程中触发 |
| AppointmentResizeCompleted | 预约调整大小完成时触发 |
| AppointmentEditorOpening | 预约编辑器打开时触发(可取消) |
| AppointmentEditorClosing | 预约编辑器关闭时触发(可取消) |
| HeaderTapped | 头部被点击/轻触时触发 |