Hi,
I have a problem using radScheduleView programmatically. Let me explain the situation :
I have some appointments that I would like to separate using resources and ResourceTypesSource property.
When creating them into XAML code, it works like a charm. but when trying to create them in code behind, it doesn't work, all my appointments are blended.
Here is an example using XAML :
And here is the code that generate appointments :
Here is the code for GenererApp :
Now, here is the programmatically method that doesn't work :
In the code behind :
With this one, my appointments are displayed but not grouped...
Did I forgot something ?
Thanks
Steeve
I have a problem using radScheduleView programmatically. Let me explain the situation :
I have some appointments that I would like to separate using resources and ResourceTypesSource property.
When creating them into XAML code, it works like a charm. but when trying to create them in code behind, it doesn't work, all my appointments are blended.
Here is an example using XAML :
<
telerik:RadScheduleView
x:Name
=
"Sched"
AppointmentsSource
=
"{Binding Appointments}"
GroupHeaderContentTemplateSelector
=
"{StaticResource GroupHeaderTplSelector}"
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:TimelineViewDefinition
/>
</
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:RadScheduleView.ResourceTypesSource
>
<
telerik:ResourceTypeCollection
>
<
telerik:ResourceType
Name
=
"Location"
>
<
telerik:Resource
ResourceName
=
"Loc 1"
/>
<
telerik:Resource
ResourceName
=
"Loc 2"
/>
<
telerik:Resource
ResourceName
=
"Loc 3"
/>
</
telerik:ResourceType
>
</
telerik:ResourceTypeCollection
>
</
telerik:RadScheduleView.ResourceTypesSource
>
<
telerik:RadScheduleView.GroupDescriptionsSource
>
<
telerik:GroupDescriptionCollection
>
<
telerik:ResourceGroupDescription
ResourceType
=
"Location"
>
</
telerik:ResourceGroupDescription
>
</
telerik:GroupDescriptionCollection
>
</
telerik:RadScheduleView.GroupDescriptionsSource
>
</
telerik:RadScheduleView
>
And here is the code that generate appointments :
Dim
r1
As
New
Resource(
"Loc 1"
,
"Location"
)
Dim
r2
As
New
Resource(
"Loc 2"
,
"Location"
)
Dim
r3
As
New
Resource(
"Loc 3"
,
"Location"
)
Me
.Appointments =
New
ObservableCollection(Of Appointment)
For
i
As
Integer
= 0
To
8
Me
.Appointments.Add(GenererApp(r1))
Next
For
i
As
Integer
= 0
To
8
Me
.Appointments.Add(GenererApp(r2))
Next
For
i
As
Integer
= 0
To
8
Me
.Appointments.Add(GenererApp(r3))
Next
Here is the code for GenererApp :
Private
Function
GenererApp(r
As
Resource)
As
Appointment
Dim
a
As
New
Appointment()
With
{.Start = DateTime.Now, .
End
= DateTime.Now.AddDays(1)}
a.Resources.Add(r)
a.Subject =
"coucou"
Me
.Appointments.Add(a)
Return
a
End
Function
Now, here is the programmatically method that doesn't work :
<
telerik:RadScheduleView
x:Name
=
"Sched"
AppointmentsSource
=
"{Binding Appointments}"
GroupHeaderContentTemplateSelector
=
"{StaticResource GroupHeaderTplSelector}"
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:TimelineViewDefinition
/>
</
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:RadScheduleView.GroupDescriptionsSource
>
<
telerik:GroupDescriptionCollection
>
<
telerik:ResourceGroupDescription
ResourceType
=
"Location"
>
</
telerik:ResourceGroupDescription
>
</
telerik:GroupDescriptionCollection
>
</
telerik:RadScheduleView.GroupDescriptionsSource
>
</
telerik:RadScheduleView
>
In the code behind :
'Resources
Dim
rc
As
New
ResourceTypeCollection
Dim
rt
As
New
ResourceType(
"Location"
)
rc.Add(rt)
Dim
r1
As
New
Resource(
"Loc 1"
,
"Location"
)
Dim
r2
As
New
Resource(
"Loc 2"
,
"Location"
)
Dim
r3
As
New
Resource(
"Loc 3"
,
"Location"
)
Me
.Sched.ResourceTypesSource = rc
'Appointments
Me
.Appointments =
New
ObservableCollection(Of Appointment)
For
i
As
Integer
= 0
To
8
Me
.Appointments.Add(GenererApp(r1))
Next
For
i
As
Integer
= 0
To
8
Me
.Appointments.Add(GenererApp(r2))
Next
For
i
As
Integer
= 0
To
8
Me
.Appointments.Add(GenererApp(r3))
Next
With this one, my appointments are displayed but not grouped...
Did I forgot something ?
Thanks
Steeve