This question is locked. New answers and comments are not allowed.
I have been working on a form with the RadScheduleView and noticed that the AllDayEvent area at the top disappeared at some point in my development. I realised that by adding a ResourceGroupDescription to the GroupDescriptionCollection, the AllDayEvent area disappears even though the ViewDefinition still has the ShowAllDayArea attribute as "True".
Is this a bug? Is there a way I can group my appointments and still have all day appointments at the top? This is an essential feature for our product.
Below is simplified code which demonstrates the issue:
(I wanted to attach a zip with the project but it only allowed me to attach image files)
Is this a bug? Is there a way I can group my appointments and still have all day appointments at the top? This is an essential feature for our product.
Below is simplified code which demonstrates the issue:
(I wanted to attach a zip with the project but it only allowed me to attach image files)
<
Grid
x:Name
=
"LayoutRoot"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
Controls:RadButton
Content
=
"{Binding ButtonText}"
Command
=
"{Binding ToggleCommand}"
Height
=
"50"
/>
<
telerik:RadScheduleView
Grid.Row
=
"1"
AppointmentsSource
=
"{Binding Appointments}"
ResourceTypesSource
=
"{Binding ResourceTypes}"
GroupDescriptionsSource
=
"{Binding GroupDescriptions}"
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:WeekViewDefinition
ShowAllDayArea
=
"True"
MinTimeRulerExtent
=
"1"
/>
<
telerik:DayViewDefinition
ShowAllDayArea
=
"True"
MinTimeRulerExtent
=
"1"
/>
</
telerik:RadScheduleView.ViewDefinitions
>
</
telerik:RadScheduleView
>
</
Grid
>
public
class
MainViewModel : ViewModelBase
{
private
readonly
ResourceGroupDescription _resourceGroupDescription;
private
bool
_showGroupDescription;
public
MainViewModel()
{
ToggleCommand =
new
RelayCommand(Toggle);
_resourceGroupDescription =
new
ResourceGroupDescription {ResourceType =
"Staff"
};
GroupDescriptions =
new
GroupDescriptionCollection {
new
DateGroupDescription()};
ResourceTypes =
new
ObservableCollection<ResourceType> {
new
ResourceType(
"Staff"
) {Resources = {
new
Resource(
"John"
),
new
Resource(
"Mark"
)}}};
Appointments =
new
ObservableCollection<IAppointment>();
Toggle();
// populate test appointments
for
(var i = -7; i < 7; i++)
{
var date = DateTime.Today.AddDays(i).Add(
new
TimeSpan(9, 30, 0));
var isAllDay = i%3 == 0;
var resourceName = i % 2 == 0 ?
"John"
:
"Mark"
;
var subject = resourceName + (isAllDay ?
" All Day Event"
:
" Appointment"
);
Appointments.Add(
new
Appointment
{
Start = date,
End = date.AddHours(8),
Subject = subject,
IsAllDayEvent = isAllDay,
Resources = {
new
Resource(resourceName,
"Staff"
)}
});
}
}
public
ICommand ToggleCommand {
get
;
private
set
; }
public
ObservableCollection<IAppointment> Appointments {
get
;
private
set
; }
public
GroupDescriptionCollection GroupDescriptions {
get
;
private
set
; }
public
ObservableCollection<ResourceType> ResourceTypes {
get
;
private
set
; }
private
string
_buttonText;
public
string
ButtonText
{
get
{
return
_buttonText; }
set
{ Set(() => ButtonText,
ref
_buttonText, value); }
}
private
void
Toggle()
{
_showGroupDescription = !_showGroupDescription;
if
(_showGroupDescription)
{
GroupDescriptions.Add(_resourceGroupDescription);
ButtonText =
"Remove Group Description"
;
}
else
{
GroupDescriptions.Remove(_resourceGroupDescription);
ButtonText =
"Show Group Description"
;
}
}
}