ViewDefinition only with Days that have an appointment?

3 posts, 0 answers
  1. Simon
    Simon avatar
    9 posts
    Member since:
    Sep 2010

    Posted 06 Jun 2012 Link to this post


    is it possible to create a ViewDefinition only with Days that have an appointment?

    i have tried it but cant figure out how that can be done...

  2. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 08 Jun 2012 Link to this post

    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#
    MonthViewDefinition monthDefintion = new MonthViewDefinition();
    DayViewDefinition dayDefintion = new DayViewDefinition();
    WeekViewDefinition weekDefinition = new WeekViewDefinition();
    TimelineViewDefinition timelineDefinition = new TimelineViewDefinition();

    Or you can do it in XAML,

    <telerik:RadScheduleView AppointmentsSource="{Binding Appointments}" x:Name="scheduleView">


    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!



  3. DevCraft R3 2016 release webinar banner
  4. Daní
    Daní avatar
    303 posts
    Member since:
    Feb 2008

    Posted 27 Jun 2012 Link to this post

    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:

            <local:MyViewModel x:Key="ViewModel"/>
    <Grid x:Name="LayoutRoot" DataContext="{StaticResource ViewModel}">
            <telerik:RadScheduleView AppointmentsSource="{Binding Path=MyAppointments}">
                    <telerik:WeekViewDefinition GroupFilter="{Binding Path=DateFilter}"/>

    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; }
                    _dateFilter = value;
            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.
Back to Top