DevExpress Universal Subscription
DevExpress WinForms Subscription
DevExpress WPF Subscription
DevExtreme跨平台开发框架
DevExpress VCL Controls
.NET开发框架eXpressApp Framework(XAF)
DevExpress学院
中文文档库
// Data context
public class SchedulingDataContext : DbContext {
public SchedulingDataContext() : base(CreateConnection(), true) { }
static DbConnection CreateConnection() {
//...
// Data items
public DbSet<AppointmentEntity> AppointmentEntities { get; set; }
//...
// Event implementation
void dataSource_FetchAppointments(object sender, DevExpress.Xpf.Scheduling.FetchDataEventArgs e) {
// Pass data objects to the event's Result property
e.Result = dbContext.AppointmentEntities.Where(
// The search query.
// Use the item's QueryStart and QueryEnd properties to calculate the correct interval
// as they take recurrence patterns into account.
// The event's Interval property returns the time interval for which to load data objects.
// Its value is the SchedulerControl.VisibleIntervals extended to the DataSource.FetchRange property value in both directions.
x => x.QueryStart <= e.Interval.End && x.QueryEnd >= e.Interval.Start)
.ToArray();
void FetchAppointments(FetchDataEventArgs e) {
e.Result = dbContext.AppointmentEntities
.Where(e.GetFetchExpression<AppointmentEntity>()).ToArray();
<dxsch:SchedulerControl
AppointmentAdded="ProcessChanges"
AppointmentEdited="ProcessChanges"
AppointmentRemoved="ProcessChanges"
AppointmentRestored="ProcessChanges"/>
void ProcessChanges(object sender, AppointmentCRUDEventArgs e) {
db.Appointments.AddRange(e.AddToSource.Select(x => (Appointment)x.SourceObject));
db.Appointments.RemoveRange(e.DeleteFromSource.Select(x => (Appointment)x.SourceObject));
db.SaveChanges();
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/3236.html
相关产品:
DevExpress Universal Subscription,