title: Apply recurrence to an appointment on code behind (DevExpress Scheduler Control)
body: <p>I am using the <a href="http://documentation.devexpress.com/#wpf/CustomDocument8679" rel="nofollow">devExpress scheduler control</a>. 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.</p>
  
  <p><strong>My window consists of a scheduler Control:</strong></p>
  
  <pre><code>&lt;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"&gt;
  
      &lt;dxsch:SchedulerControl Name="schedulerControl1" /&gt;
  
  &lt;/Window&gt;
  </code></pre>
  
  <p><strong>And code behind consists of:</strong></p>
  
  <pre><code>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; // &lt;- App Crashes
          }               
      }
  }
  </code></pre>
  
  <p>I do not want to bind the recurrence property of the control. </p>
  
  <p><strong>In other words</strong> 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?</p>