HeaderPane
Main
Hide
Share Link
Print

RefreshDays Method, SftCalendar Class

Raises the SftCalendar.DayFormatting event again for all days.

Class: SftCalendar
Namespace: Softelvdm.SftDateNET
Assembly: Softelvdm.SftDateNET

Syntax

public void RefreshDays();
Public Sub RefreshDays()

Comments

Raises the SftCalendar.DayFormatting event again for all days.

Call this method after a change that affects the results of a SftCalendar.DayFormatting event handler.

Examples

C# View entire sample code

        // The DayFormatting event can change any day; here weekends without a special date are colored.
        private void AnyControl_DayFormatting(object sender, DayFormattingEventArgs e) {
            if (checkWeekends.Checked && e.IsWeekend && e.SpecialDate == null)
                e.ForeColor = Color.IndianRed;
        }

        private void checkWeekends_CheckedChanged(object sender, EventArgs e) {
            sftCalendar1.RefreshDays();
        }

        private void checkRange_CheckedChanged(object sender, EventArgs e) {
            sftCalendar1.SelectionMode = checkRange.Checked ? SelectionModeEnum.Range : SelectionModeEnum.Single;
            ShowSelection();
        }

        private void checkDropOnFocus_CheckedChanged(object sender, EventArgs e) {

VB.NET View entire sample code

    ' The DayFormatting event can change any day; here weekends without a special date are colored.
    Private Sub AnyControl_DayFormatting(ByVal sender As Object, ByVal e As DayFormattingEventArgs) Handles SftDate1.DayFormatting, SftDate2.DayFormatting, SftDate5.DayFormatting, SftDate6.DayFormatting, SftDate7.DayFormatting, SftDate8.DayFormatting, SftDate9.DayFormatting, SftCalendar1.DayFormatting
        If CheckWeekends.Checked AndAlso e.IsWeekend AndAlso e.SpecialDate Is Nothing Then
            e.ForeColor = Color.IndianRed
        End If
    End Sub

    Private Sub CheckWeekends_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles CheckWeekends.CheckedChanged
        SftCalendar1.RefreshDays()
    End Sub

    Private Sub CheckRange_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles CheckRange.CheckedChanged
        SftCalendar1.SelectionMode = If(CheckRange.Checked, SelectionModeEnum.Range, SelectionModeEnum.Single)
        ShowSelection()
    End Sub

See Also SftCalendar Class | Classes | SftDate/NET 3.0