Hello
I need to add appointments in a few locationRessources with code behind. I can build and run my project but the appointments don't appear in the RadScheduleView.
Here is my xaml code:
Here is my code behind:
Can you explain to me what am i missing ?
thanx !
I need to add appointments in a few locationRessources with code behind. I can build and run my project but the appointments don't appear in the RadScheduleView.
Here is my xaml code:
<
Window
x:Class
=
"TelerikWpfApp1.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
telerik:RadScheduleView
HorizontalAlignment
=
"Left"
Margin
=
"10,10,0,0"
VerticalAlignment
=
"Top"
Name
=
"xRadScheduleView"
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:DayViewDefinition
Orientation
=
"Horizontal"
DayStartTime
=
"7:00"
DayEndTime
=
"21:00"
/>
<
telerik:WeekViewDefinition
/>
<
telerik:MonthViewDefinition
/>
<
telerik:TimelineViewDefinition
/>
</
telerik:RadScheduleView.ViewDefinitions
>
</
telerik:RadScheduleView
>
</
Grid
>
</
Window
>
Here is my code behind:
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
ResourceType locationResource = new ResourceType("BlocsOperatoires");
locationResource.Resources.Add(new Resource("Bloc 1"));
locationResource.Resources.Add(new Resource("Bloc 2"));
locationResource.Resources.Add(new Resource("Bloc 3"));
locationResource.Resources.Add(new Resource("Bloc 4"));
locationResource.Resources.Add(new Resource("Bloc 5"));
this.xRadScheduleView.ResourceTypesSource = new ResourceTypeCollection
{
locationResource
};
GroupDescriptionCollection groupDescription = new GroupDescriptionCollection
{
new DateGroupDescription(),
new ResourceGroupDescription{ ResourceType = "BlocsOperatoires" }
};
this.xRadScheduleView.GroupDescriptionsSource = groupDescription;
var appointments = new ObservableCollection<
Appointment
>();
appointments.Add(new Appointment()
{
Subject = "I'm a new Appointment",
Start = new DateTime(2014, 7, 8, 8, 30, 00),
End = new DateTime(2014, 7, 8, 10, 30, 00),
Location = locationResource.Resources.ElementAt(1).ResourceName
});
appointments.Add(new Appointment()
{
Subject = "I'm a new Appointment 2",
Start = new DateTime(2014, 7, 8, 8, 30, 00),
End = new DateTime(2014, 7, 8, 10, 30, 00),
Location = locationResource.Resources.ElementAt(3).ResourceName
});
xRadScheduleView.AppointmentsSource = appointments;
}
Can you explain to me what am i missing ?
thanx !