我正在使用devExpress 调度程序控件。请注意,我在以下代码中要实现的目标是在代码后面的约会中添加重复。在此示例中,我在创建新约会时这样做。
我的窗口由一个调度程序控件组成:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler">
<dxsch:SchedulerControl Name="schedulerControl1" />
</Window>
后面的代码包括:
using System.Windows;
using DevExpress.XtraScheduler;
namespace WpfApplication1
{
public partial class MainWindow : Window
{
public MainWindow() // Constructor
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
}
void MainWindow_Loaded(object sender, RoutedEventArgs e) // Fires when window loads
{
schedulerControl1.Storage.AppointmentsInserted += new PersistentObjectsEventHandler(Storage_AppointmentsInserted);
}
void Storage_AppointmentsInserted(object sender, PersistentObjectsEventArgs e) // fires when a new appointment is added
{
Appointment addedAppointment = null;
foreach (Appointment item in e.Objects)
addedAppointment = item;
/*
I want to set the reinsurance info in here!
I cant because RecuranceInfo = null!
*/
addedAppointment.RecurrenceInfo.Type = RecurrenceType.Hourly; // <- App Crashes
}
}
}
我不想绑定控件的重复属性。
换句话说,如果我可以创建一个从今天下午 2 点开始并每天重复且没有结束日期的约会,那就太好了。我怎么能在后面的代码上创建那个约会?