I am using the devExpress scheduler control. Note what I am trying to achieve on the following code is to add a recurance to an appointment on code behind. In this example I am doing that when I create a new appointment.
My window consists of a scheduler Control:
<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>
And code behind consists of:
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
}
}
}
I do not want to bind the recurrence property of the control.
In other words It will be great if I could create an appointment that starts at 2PM today and repeats daily with no end date. How could I be able to create that appointment on code behind?
Answer is in this link: http://documentation.devexpress.com/#WindowsForms/CustomDocument6201
basically I had to do: