HeaderPane
Main
Hide
Share Link
Print

RefreshDays Method, SftDateCalendar Object

Formats all days again (DayFormatting event).

Syntax

C#void object.RefreshDays();
VB.NETobject.RefreshDays()
C++HRESULT object->RefreshDays();
CHRESULT object->raw_RefreshDays();

object

A SftDateCalendar object.

Comments

The RefreshDays method discards the formatting of the days shown in a calendar and repaints them, so the control raises the DayFormatting event for each day again. An application calls it when the data it uses to format days changes, for example appointments that were added. p For a date field control, RefreshDays refreshes the dropdown calendar if it is open; a dropdown calendar formats its days each time the dropdown opens. Changes of special dates and calendar settings made using the SftDate/OCX properties refresh the days automatically.

Examples

C# View entire sample code

                ForEachCalendar(cal => cal.ShowTodayButton = checkTodayButton.Checked);
            } else if (sender == checkHighlightToday) {
                ForEachCalendar(cal => cal.HighlightToday = checkHighlightToday.Checked);
            } else if (sender == checkClearButton) {
                ForEachCalendar(cal => cal.ShowClearButton = checkClearButton.Checked);
            } else if (sender == checkHolidays) {
                SetHolidays(checkHolidays.Checked);
            } else if (sender == checkWeekends) {
                // the DayFormatting event colors the days; RefreshDays asks for them again
                ForEachCalendar(cal => cal.RefreshDays());
            } else if (sender == checkDisableWeekends) {
                ForEachCalendar(cal => cal.DisabledDaysOfWeek = checkDisableWeekends.Checked ? SftDateDaysConstants.daysSftDateWeekend : SftDateDaysConstants.daysSftDateNone);
            } else if (sender == checkRangeSelect) {
                sftCalendar.SelectionMode = checkRangeSelect.Checked ? SftDateSelectionModeConstants.selectionSftDateRange : SftDateSelectionModeConstants.selectionSftDateSingle;
                ShowSelection();
            } else if (sender == checkThisYear) {

VB.NET View entire sample code

            ForEachCalendar(Sub(cal) cal.ShowTodayButton = checkTodayButton.Checked)
        ElseIf sender Is checkHighlightToday Then
            ForEachCalendar(Sub(cal) cal.HighlightToday = checkHighlightToday.Checked)
        ElseIf sender Is checkClearButton Then
            ForEachCalendar(Sub(cal) cal.ShowClearButton = checkClearButton.Checked)
        ElseIf sender Is checkHolidays Then
            SetHolidays(checkHolidays.Checked)
        ElseIf sender Is checkWeekends Then
            ' the DayFormatting event colors the days; RefreshDays asks for them again
            ForEachCalendar(Sub(cal) cal.RefreshDays())
        ElseIf sender Is checkDisableWeekends Then
            ForEachCalendar(Sub(cal) cal.DisabledDaysOfWeek = If(checkDisableWeekends.Checked, SftDateDaysConstants.daysSftDateWeekend, SftDateDaysConstants.daysSftDateNone))
        ElseIf sender Is checkRangeSelect Then
            sftCalendar.SelectionMode = If(checkRangeSelect.Checked, SftDateSelectionModeConstants.selectionSftDateRange, SftDateSelectionModeConstants.selectionSftDateSingle)
            ShowSelection()
        ElseIf sender Is checkThisYear Then

C++ View entire sample code

        break;
    case IDC_CLEARBUTTON:
        ForEachControl([&](auto& ctl) { ctl->Calendar->ShowClearButton = vbChecked; });
        break;
    case IDC_HOLIDAYS:
        SetHolidays(fChecked);
        break;
    case IDC_WEEKENDS:
        // the DayFormatting event colors the days; RefreshDays asks for them again
        ForEachControl([&](auto& ctl) { ctl->Calendar->RefreshDays(); });
        break;
    case IDC_DISABLEWEEKENDS:
        ForEachControl([&](auto& ctl) { ctl->Calendar->DisabledDaysOfWeek = fChecked ? daysSftDateWeekend : daysSftDateNone; });
        break;
    case IDC_RANGESELECT:
        m_Calendar->SelectionMode = fChecked ? selectionSftDateRange : selectionSftDateSingle;

See Also SftDateCalendar Object | Object Hierarchy | Day Formatting


Last Updated 11/29/2026 - (email)
© 2026 Softel vdm, Inc.