2 Answers, 1 is accepted
0
Lancelot
Top achievements
Rank 1
answered on 08 Jun 2012, 08:05 PM
Hi Simon,
This link brings you to the documentation of the four default ViewDefinitions that are part of the RadScheduleView control. Notice after the second paragraph, telerik states "Also, through defining different properties you can create your own custom view."
You can create your own ViewDefinition by adding in here with c#
This link brings you to the documentation of the four default ViewDefinitions that are part of the RadScheduleView control. Notice after the second paragraph, telerik states "Also, through defining different properties you can create your own custom view."
You can create your own ViewDefinition by adding in here with c#
MonthViewDefinition monthDefintion =
new
MonthViewDefinition();
DayViewDefinition dayDefintion =
new
DayViewDefinition();
WeekViewDefinition weekDefinition =
new
WeekViewDefinition();
TimelineViewDefinition timelineDefinition =
new
TimelineViewDefinition();
this
.scheduleView.ViewDefinitions.Add(monthDefintion);
this
.scheduleView.ViewDefinitions.Add(dayDefintion);
this
.scheduleView.ViewDefinitions.Add(timelineDefinition);
this
.scheduleView.ViewDefinitions.Add(weekDefinition);
Or you can do it in XAML,
<
telerik:RadScheduleView
AppointmentsSource
=
"{Binding Appointments}"
x:Name
=
"scheduleView"
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:DayViewDefinition
/>
<
telerik:MonthViewDefinition
/>
<
telerik:WeekViewDefinition
/>
<
telerik:TimelineViewDefinition
/>
</
telerik:RadScheduleView.ViewDefinitions
>
</
telerik:RadScheduleView
>
Either way you have to write your own View first then add it to the control.
Learn about the configuration of the ViewDefinitions here.
Then learn about the specific View properties needed here.
I hope this clears things up for you, but out of the box RadScheduleViewer has these four ViewDefinitions:
- DayViewDefiniton
- MonthViewDefinition
- TimelineViewDefinition
- WeekViewDefinition
Good Luck!
Lancelot
0
Daní
Top achievements
Rank 1
answered on 27 Jun 2012, 08:38 AM
Hi Simon,
I don't know if you already solved this issue. I'm doing something very similar and, maybe, it can be helpful for your purposes.
First of all, you need to decide the max number of visibles dates you want in your view. In my case, I wanted a WeekViewDefinition, so not to show more than seven days. A very simple way to reach this behavior is providing a DateGroupDescripion to the RadSchedulerView, define ther a WeekViewDefinition and supply a GroupFilter. Let's suppose you have ViewModel, call it MyViewModel with a property called MyAppointments of type ObservableCollection<Appointment>.
The xaml, very basic, might look like this:
The MyViewModel implementation, again very basic, might look like this.
Really easy. When you supply a DateGroupDescription to the ScheduleView and a GroupFilter to the ViewDefinition, the GroupFilter implementation is invoked for each date to check if it passes the filter. In DateFilterFunc, you just need to check if there's any appointment starting or ending at this date,
Hope this helps and I'm sorry the delay.
I don't know if you already solved this issue. I'm doing something very similar and, maybe, it can be helpful for your purposes.
First of all, you need to decide the max number of visibles dates you want in your view. In my case, I wanted a WeekViewDefinition, so not to show more than seven days. A very simple way to reach this behavior is providing a DateGroupDescripion to the RadSchedulerView, define ther a WeekViewDefinition and supply a GroupFilter. Let's suppose you have ViewModel, call it MyViewModel with a property called MyAppointments of type ObservableCollection<Appointment>.
The xaml, very basic, might look like this:
<
UserControl.Resources
>
<
local:MyViewModel
x:Key
=
"ViewModel"
/>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
DataContext
=
"{StaticResource ViewModel}"
>
<
telerik:RadScheduleView
AppointmentsSource
=
"{Binding Path=MyAppointments}"
>
<
telerik:RadScheduleView.GroupDescriptionsSource
>
<
telerik:GroupDescriptionCollection
>
<
telerik:DateGroupDescription
/>
</
telerik:GroupDescriptionCollection
>
</
telerik:RadScheduleView.GroupDescriptionsSource
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:WeekViewDefinition
GroupFilter
=
"{Binding Path=DateFilter}"
/>
</
telerik:RadScheduleView.ViewDefinitions
>
</
telerik:RadScheduleView
>
</
Grid
>
The MyViewModel implementation, again very basic, might look like this.
public
class
MyViewModel: ViewModelBase
{
public
MyViewModel()
{
//ToDo: initialize MyAppointments collection
DateFilter = DateFilterFunc;
}
public
ObservableCollection<Appointment> MyAppointments {
get
;
set
; }
private
Func<
object
,
bool
> _dateFilter;
public
Func<
object
,
bool
> DateFilter
{
get
{
return
_dateFilter; }
set
{
_dateFilter = value;
OnPropertyChanged(
"DateFilter"
);
}
}
private
bool
DateFilterFunc(
object
value)
{
if
(value
is
DateTime)
{
var date = (DateTime)value;
return
MyAppointments.Where(x => x.Start.Date == date.Date || x.End.Date == date.Date).Any();
}
return
true
;
}
}
Really easy. When you supply a DateGroupDescription to the ScheduleView and a GroupFilter to the ViewDefinition, the GroupFilter implementation is invoked for each date to check if it passes the filter. In DateFilterFunc, you just need to check if there's any appointment starting or ending at this date,
Hope this helps and I'm sorry the delay.