Calendar Controls for WinForms UI Tutorial Weekends hiding while customizing appearance in C# for .NET Windows Forms projects Weekends Hiding - WinForms Calendar Controls
The Windows Forms Calendar controls contain rich appearance themes for .NET Windows Forms developers. It is easy to customize the appearance by changing a single property. The Calendar Controls for WinForms user interface design support not only all features of the standard Month Calendar control in the Visual Studio toolbox, like first day of week, special days, show today, show week numbers, and hide week numbers, but also additional features that the standard Calendar control do not support, including focused date, show week days, hide week days, date zoom, read only mode as well as show other month days. This tutorial shows how to customize the appearance of day elements in C# WinForms for the Calendar. How to Customize Day Elements in C#
We can use the Element Render event to customize the appearance of day elements in Calendar. The calendar should be invalidated in the Load event handler in the C# code. The below C# code snippet is a sample to control the event: void Form1_Load(object sender, EventArgs e) { this.calendar1.ElementRender += new RenderElementEventHandler(calendar1_ElementRender); this.calendar1.InvalidateCalendar(); }
private void calendar1_ElementRender(object sender, Telerik.WinControls.UI.RenderElementEventArgs e) { if (e.Day.IsWeekend) { e.Element.Enabled = false; } }
|