This is a migrated thread and some comments may be shown as answers.

RadScheduleView - display only current month

4 Answers 123 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
peter
Top achievements
Rank 1
peter asked on 16 May 2012, 09:59 AM
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

4 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 16 May 2012, 10:07 AM
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 >>

0
rahul
Top achievements
Rank 1
answered on 16 Jul 2012, 11:13 AM
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
0
Vladi
Telerik team
answered on 17 Jul 2012, 11:20 AM
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.

0
rahul
Top achievements
Rank 1
answered on 23 Jul 2012, 05:33 AM
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);

 

}

}

Tags
ScheduleView
Asked by
peter
Top achievements
Rank 1
Answers by
Yana
Telerik team
rahul
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or