24 hour appointment

4 posts, 1 answers
  1. Mark
    Mark avatar
    24 posts
    Member since:
    Jul 2012

    Posted 31 Jul 2012 Link to this post

    Hi,

    I'm trying to add an appointment to my ScheduleView using:

    var appointments = new ObservableCollection<Appointment>();
    Appointment myAppointment = 
    new Appointment();
    myAppointment.Subject = "Appointment Here";
    myAppointment.Start = new DateTime(2012, 7, 31, 00, 00, 00);
    myAppointment.End = new DateTime(2012, 7, 31, 2, 00, 00);
    appointments.Add(myAppointment);
     
    scheduleView.AppointmentsSource = appointments;

    The above code works, but when I change the End date of myAppointment to  myAppointment.End = new DateTime(2012, 7, 31, 24, 00, 00); I'm getting a XamlParseException.

    How should I be adding a 24hour appointment? Should it be just myAppointment.End = new DateTime(2012, 7, 31, 23, 59, 00);?


    Thanks,
    Mark
  2. Answer
    Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 01 Aug 2012 Link to this post

    Hi Mark,

    Try this:

    myAppointment.End = new DateTime(2012, 8, 01, 00, 00, 00); 


    Good Luck,
    Lancelot
  3. UI for WPF is Visual Studio 2017 Ready
  4. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 02 Aug 2012 Link to this post

    Hello Mark,

    The other option is to set IsAllDayEvent property of the appointment:

    Appointment allDayAppointment = new Appointment
    {
        Start = new DateTime(2012, 8, 2),
        End = new DateTime(2012, 8, 3),
        IsAllDayEvent = true,
        Subject = "All day event",
    };

    I hope this is helpful.

    Greetings,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Mark
    Mark avatar
    24 posts
    Member since:
    Jul 2012

    Posted 02 Aug 2012 Link to this post

    I see. Thanks for the help :)
Back to Top