RadScheduleView - display only current month

5 posts, 1 answers
  1. peter
    peter avatar
    37 posts
    Member since:
    Feb 2011

    Posted 16 May 2012 Link to this post

    Hi, is it possible to dipslay only the current month on a radsheduleview. I dont want to display the preceding days of  the previous month or the days of the next month
  2. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 16 May 2012 Link to this post

    Hi Peter,

    I am afraid that you cannot set MonthViewDefinition to show only the current month - it is designed to display groups of seven days, so you can set VisibleDays only to number which can be divided by 7, the default value is 42. Anyway, you can use special slots and make the days from the previous/next months as read-only.

    All the best,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. rahul
    rahul avatar
    25 posts
    Member since:
    Jan 2011

    Posted 16 Jul 2012 Link to this post

    Hi yana,

    Can you please expalin this with example? I want to show previous/next months days in different color in Month view(like in outlook). See the screen shot attached. (Prev/Next months days are in blue color)

    Quick help is really appreciated.

    Thanks,
    Rahul
  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 17 Jul 2012 Link to this post

    Hi Rahul,

    To add special slots in RadScheduleView you will need to create an ObservableCollection<Slot> variable and bind it to the SpecialSlotsSource property. You can find more detailed information on how to add special slots in this article.

    I have prepared and attached a sample project for you, give it a try.

    Greetings,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. rahul
    rahul avatar
    25 posts
    Member since:
    Jan 2011

    Posted 23 Jul 2012 Link to this post

    Thank you Vladi. It's working perfect.
    I have modified sample as a generic implementation as below.

     

     

    private ObservableCollection<Slot> _specialSlots;

     

     

     

    public ObservableCollection<Slot> SpecialSlots

     

    {

     

     

    get { return _specialSlots;}

     

     

     

    set

     

    {

    _specialSlots =

     

    value;

     

    RaisePropertyChanged(

     

    "SpecialSlots");

     

    }

    }

     

     

    public void GenerateSpecialSlots(DateTime currMonth)

     

    {

     

     

    var previousMonthsSlot = new Slot()

     

    {

    Start =

     

    DateTime.MinValue,

     

    End =

     

    new DateTime(currMonth.Year, currMonth.Month, 1),

     

    IsReadOnly =

     

    true

     

    };

     

     

    var nextMonth = currMonth.AddMonths(1);

     

     

     

    var nextMonthsSlot = new Slot()

     

    {

    Start =

     

    new DateTime(nextMonth.Year, nextMonth.Month, 1),

     

    End =

     

    DateTime.MaxValue,

     

    IsReadOnly =

     

    true

     

    };

     

     

    var result = new ObservableCollection<Slot>()

     

    {

    previousMonthsSlot, nextMonthsSlot

    };

    SpecialSlots = result;

    }

     

     

    private void xRadScheduleView_VisibleRangeChanged(object sender, EventArgs e)

     

    {

     

     

    if (this.DataContext != null)

     

    {

     

     

    var view = xRadScheduleView.ViewDefinitions[0];

     

    ((

     

    MyViewModel)this.DataContext).GenerateSpecialSlots(xRadScheduleView.CurrentDate);

     

    }

    }

Back to Top
DevCraft banner