Completed
Last Updated: 25 May 2015 15:05 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 25 Mar 2014 11:38
Category: Calendar
Type: Bug Report
0
FIX. RadCalendar - setting the TemplateItem for a RadCalendarDay in the SpecialDays collection in the ViewChanged event returns you to the current month
Use the following code snippet:

private void radCalendar1_ViewChanged(object sender, EventArgs e)
{
    this.radCalendar1.SpecialDays.Clear();

    RadCalendarDay day = new RadCalendarDay(new DateTime(2014,04,15));
    radCalendar1.SpecialDays.Add(day);
    PictureBox pictureBox = new PictureBox();
    pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
    pictureBox.Image = Properties.Resources.home;
    RadHostItem hostItem = new RadHostItem(pictureBox);
    day.TemplateItem = hostItem;
}

Clicking the navigation buttons does not navigate you to the respective month.

Workaround: assign the RadCalendarDay.TemplateItem before adding the day in the SpecialDays collection:
private void radCalendar1_ViewChanged(object sender, EventArgs e)
{
    this.radCalendar1.SpecialDays.Clear();

    RadCalendarDay day = new RadCalendarDay(new DateTime(2014,04,15));
    PictureBox pictureBox = new PictureBox();
    pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
    pictureBox.Image = Properties.Resources.home;
    RadHostItem hostItem = new RadHostItem(pictureBox);
    day.TemplateItem = hostItem; 
    radCalendar1.SpecialDays.Add(day);
}

Note: if the initial code is used in the ViewChanging event, clicking the navigation buttons leads to freezing the application.
0 comments