The SftCalendar.DayFormatting event occurs before a calendar shows a day, so the application can change how the day is shown and whether it can be selected. The SftDate.DayFormatting event does the same for the dropdown calendar of a field. Use it for days that follow a rule, such as weekends, paydays or the days of a booking system.

The DayFormattingEventArgs object passed to the event handler describes the day. Its properties are filled in from the calendar's settings and the special date that applies to the day (DayFormattingEventArgs.SpecialDate), so the event handler changes only what it needs:
| Property | Description |
|---|---|
| DayFormattingEventArgs.Date, IsToday, IsWeekend, InRange | Describe the day (read-only). |
| DayFormattingEventArgs.Enabled | Whether the day can be selected. |
| DayFormattingEventArgs.Bold, Font | Bold text, or a font of its own. |
| DayFormattingEventArgs.ForeColor, BackColor | The text and background colors. |
| DayFormattingEventArgs.Image | An image shown with the day. |
| DayFormattingEventArgs.ToolTip | The tooltip of the day. |
| DayFormattingEventArgs.Text | A text shown instead of the day number. |
C#
private void sftCalendar1_DayFormatting(object sender, DayFormattingEventArgs e) { if (e.IsWeekend) e.ForeColor = Color.IndianRed; if (e.Date.Day == 1) { e.Bold = true; e.BackColor = Color.FromArgb(225, 240, 225); } }
VB
Private Sub SftCalendar1_DayFormatting(sender As Object, e As DayFormattingEventArgs) Handles SftCalendar1.DayFormatting If e.IsWeekend Then e.ForeColor = Color.IndianRed End If If e.Date.Day = 1 Then e.Bold = True e.BackColor = Color.FromArgb(225, 240, 225) End If End Sub
The calendar keeps the result for each day. After a change that affects the event handler's results, call the SftCalendar.RefreshDays method so the event occurs again for all days.