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.
FIX. RadCalendar - Incorrect week numbering
Use the following code snippet:
radCalendar1.AllowMultipleView = true;
radCalendar1.MultiViewColumns = 1;
radCalendar1.MultiViewRows = 5;
radCalendar1.ShowRowHeaders = true;
CultureInfo ci = new CultureInfo("en-US");
CalendarWeekRule weekRule = CalendarWeekRule.FirstDay;
ci.DateTimeFormat.CalendarWeekRule = weekRule;
radCalendar1.Culture = ci;
Expected behavior: when the CalendarWeekRule is FirstDay, 01/01/2013 should be displayed as week 1
To reproduce: 1. Drag and drop RadCalendar to form 2. Set design time the AllowMultipleView property to true 3. Set design time value of the MultiViewRows and MultiViewColumns properties to 2 4. When save the form or run the project an exception is thrown. Workaround: Set the AllowMultipleView and MultiViewColumns properties with code.
Resolution: Add LabelFormat property to change the format of footer. You can use the following code snippet: this.radCalendar1.CalendarElement.CalendarStatusElement.LabelFormat = "yy/MM/dd dddd";
To reproduce:
public Form1()
{
InitializeComponent();
this.radCalendar1.RangeMinDate = new DateTime(2014, 1, 1);
this.radCalendar1.RangeMaxDate = new DateTime(2017, 7, 17);
this.radCalendar1.FocusedDate = new DateTime(2014, 2, 4);
this.radCalendar1.AllowFastNavigation = true;
this.radCalendar1.FastNavigationStep = 1;
this.radCalendar1.AllowMultipleView = true;
this.radCalendar1.MultiViewColumns = 4;
this.radCalendar1.MultiViewRows = 3;
this.radCalendar1.CurrentViewRow = 0;
this.radCalendar1.CurrentViewColumn = 1;
}
The user expects when fast navigating forward, the view to be shifted with one year = 12 months. However, each next forward fast navigation moves with 11 months.
Workaround:
this.radCalendar1.CurrentViewRow = 0;
this.radCalendar1.CurrentViewColumn = 0;
this.radCalendar1.CalendarElement.PreviousButton.PerformClick();
Currently, you can use reflection in order to access the properties of the fast navigation popup.
Workaround:
this.radCalendar1.HeaderNavigationMode = Telerik.WinControls.UI.HeaderNavigationMode.Popup;
CalendarNavigationElement a = this.radCalendar1.CalendarElement.CalendarNavigationElement;
FieldInfo fi = typeof(CalendarNavigationElement).GetField("dropDown", BindingFlags.NonPublic | BindingFlags.Instance);
RadDateTimePickerDropDown dropDown = (RadDateTimePickerDropDown)fi.GetValue(a);
dropDown.PopupOpening += new RadPopupOpeningEventHandler(dropDown_PopupOpening);
Workaround:
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
public RadForm1()
{
InitializeComponent();
this.radDateTimePicker1.DateTimePickerElement.Calendar.ElementRender += Calendar_ElementRender;
}
private void Calendar_ElementRender(object sender, RenderElementEventArgs e)
{
if (this.radDateTimePicker1.DateTimePickerElement.Calendar.ZoomLevel == ZoomLevel.Days)
{
return;
}
CalendarCellElement element = e.Element as CalendarCellElement;
if (element != null)
{
element.WeekEnd = false;
}
}
}
How to reproduce:
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
public RadForm1()
{
InitializeComponent();
ThemeResolutionService.ApplicationThemeName = "VisualStudio2012Light";
this.radCalendar1.ShowRowHeaders = true;
this.radCalendar1.AllowMultipleView = true;
this.radCalendar1.MultiViewRows = 2;
this.radCalendar1.MultiViewColumns = 2;
this.radCalendar1.ShowFooter = true;
this.radCalendar1.ShowOtherMonthsDays = false;
}
}
Workaround:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
MultiMonthViewElement viewElement = this.radCalendar1.CalendarElement.CalendarVisualElement as MultiMonthViewElement;
CalendarMultiMonthViewTableElement tableElement = viewElement.FindDescendant<CalendarMultiMonthViewTableElement>() as CalendarMultiMonthViewTableElement;
if (tableElement == null)
{
return;
}
foreach (RadElement child in tableElement.Children)
{
MonthViewElement monthViewElement = child as MonthViewElement;
if (monthViewElement == null)
{
continue;
}
monthViewElement.FindDescendant<CalendarCellElement>().DrawBorder = false;
}
}
Please refer to the attached sample project and run it with RadForm2.
Note: the issue is not reproduced consistently.
To reproduce:
1. Add RadCalendar/or RadDateTimePicker/ and the MaxValue of calendar control to DateTime.MaxValue.
2. Click on the header and an exception is thrown: System.ArgumentOutOfRangeException: 'The added or subtracted value results in an un-representable DateTime.
Parameter name: months'
Workaround:
To work around this issue we can stop showing this pop-up when one of the three last months of the MaxDate.Year is selected in the RadCalendar ViewChanged event: