This is a migrated thread and some comments may be shown as answers.

24 hour appointment

3 Answers 66 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 31 Jul 2012, 08:13 AM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Lancelot
Top achievements
Rank 1
answered on 01 Aug 2012, 04:46 PM
Hi Mark,

Try this:

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


Good Luck,
Lancelot
0
Vladi
Telerik team
answered on 02 Aug 2012, 01:51 PM
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.

0
Mark
Top achievements
Rank 1
answered on 03 Aug 2012, 12:08 AM
I see. Thanks for the help :)
Tags
ScheduleView
Asked by
Mark
Top achievements
Rank 1
Answers by
Lancelot
Top achievements
Rank 1
Vladi
Telerik team
Mark
Top achievements
Rank 1
Share this question
or