Hi,
I am using RadScheduleView for Calendar type implementation.
I implemented filter that works fine for all ViewDefinitions except the ViewDefinition which is first on the NavigationHeader or in other words the ViewDefinition at Index=0 is not performing Filter.
Example:-
Below is the definition of RadSchedulerView that I am using.
<telerik:RadScheduleView Name=
"xRadScheduleView"
AppointmentsSource=
"{Binding Appointments}"
ResourceTypesSource=
"{Binding ResourceTypeCollection, Mode=TwoWay}"
GroupDescriptionsSource=
"{Binding GroupDescriptions}"
MinAppointmentHeight=
"60"
NavigationHeaderVisibility=
"Visible"
SpecialSlotStyleSelector=
"{StaticResource SpecialSlotStyleSelector}"
SpecialSlotsSource=
"{Binding SpecialSlots}"
ShowCurrentTimeIndicator=
"True"
CurrentTimeIndicatorStyle=
"{StaticResource CurrentTimeIndicatorStyleCustom}"
CurrentDate=
"{Binding CurrentDate, Mode=TwoWay}"
Grid.Row=
"1"
VerticalScrollBarVisibility=
"Auto"
VerticalAlignment=
"Stretch"
SelectedSlot=
"{Binding SelectedSlot, Mode=TwoWay}"
SelectedAppointment=
"{Binding SelectedAppointment, Mode=TwoWay}"
HorizontalScrollBarVisibility=
"Visible"
>
<telerik:RadScheduleView.DragDropBehavior>
<Helper:AppointmentDragDropConditionalBehavior/>
</telerik:RadScheduleView.DragDropBehavior>
<telerik:RadScheduleView.ViewDefinitions>
<telerik:TimelineViewDefinition AppointmentFilter=
"{Binding FilterValue}"
/>
<telerik:MonthViewDefinition AppointmentFilter=
"{Binding FilterValue}"
/>
<telerik:WeekViewDefinition AppointmentFilter=
"{Binding FilterValue}"
/>
<telerik:DayViewDefinition AppointmentFilter=
"{Binding FilterValue}"
/>
</telerik:RadScheduleView.ViewDefinitions>
</telerik:RadScheduleView>
Below are the view definitions .
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:TimelineViewDefinition
AppointmentFilter
=
"{Binding FilterValue}"
/>
<
telerik:MonthViewDefinition
AppointmentFilter
=
"{Binding FilterValue}"
/>
<
telerik:WeekViewDefinition
AppointmentFilter
=
"{Binding FilterValue}"
/>
<
telerik:DayViewDefinition
AppointmentFilter
=
"{Binding FilterValue}"
/>
</
telerik:RadScheduleView.ViewDefinitions
>
The FilterValue is a property in my ViewModel. Some terminology to understand code.
- AppointmentBase is Custom Appointment derived from Appointment class as suggested in your Help website.
- Process is Resource derived from Resource class as suggested in your Help website.
- CheckedProcesses is the local property which is List of Process ( Resource)
public
Predicate<IAppointment> FilterValue
{
get
{
return
Filter;
}
}
public
bool
Filter(IAppointment appt)
{
if
(SelectedProcess ==
null
&& !SelectAllProcesses)
return
false
;
if
(SelectAllProcesses)
return
true
;
AppointmentBase app = appt
as
AppointmentBase; //Custom Appointment
return
app !=
null
&& FilterByProcess(app);
}
public
bool
FilterByProcess(DZNEAppointmentBase app)
{
bool
isFiltered =
false
;
isFiltered =
this
.CheckedProcesses.Where(s => s.ProcessID.Equals(app.Process.ProcessID)).FirstOrDefault() !=
null
;
return
isFiltered;
}
Filtering Scenario:
- When all Resources are checked we need to show all Appointment associated with each checked Resource.
- When user uncheck a Resource, all Appointment associated with that Resource should get disappear from Calendar.
Above scenario works well for all ViewDefinitions such as Day, Week, Month, Timeline and other Custom View definitions if an only if the ActiveViewDefinitionIndex is not ZERO.
So, for above view definition list in code snippet, filter is not working for very first view definition i.e. “TimelineViewDefinition”.
I just want to know what setting I am missing or if there are other ways to implement filter.
Any input will be highly appreciated.