)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the cell value of the WinForms MonthCalendarAdv?

Platform: WinForms |
Control: MonthCalendarAdv |
Published Date: May 20, 2015 |
Last Revised Date: January 6, 2020

Customize the cell value

The appearance and accessibility of the cell value can be customized by handling the event named, DateCellQueryInfo in the MonthCalendarAdv. The following code example demonstrates the same.

C#

//Handles this event to provide custom formatting for calendar cells.
this.monthCalendarAdv1.DateCellQueryInfo += new Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventHandler(monthCalendarAdv1_DateCellQueryInfo);
void monthCalendarAdv1_DateCellQueryInfo(object sender, Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs e)
{
    if (this.monthCalendarAdv1.Value.Date == DateTime.Today)
    {
        //Disables the highlight color of the selected date value.
        e.EnableHighlightColor = false;
    }
    if (e.RowIndex == 3 || e.RowIndex == 4)
    {
        //Customizes the particular cell value.
        e.Style.BackColor = Color.Red;
        e.Style.TextColor = Color.White;
    }
}

VB

'Handles this event to provide custom formatting for calendar cells.
AddHandler monthCalendarAdv1.DateCellQueryInfo, AddressOf monthCalendarAdv1_DateCellQueryInfo
Private Sub monthCalendarAdv1_DateCellQueryInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs)
    If Me.monthCalendarAdv1.Value.Date = DateTime.Today Then
        'Disables the highlight color of the selected date value.
        e.EnableHighlightColor = False
    End If
    If e.RowIndex = 3 OrElse e.RowIndex = 4 Then
        'Customizes the particular cell value.
         e.Style.BackColor = Color.Red
         e.Style.TextColor = Color.White
    End If
End Sub

The following image shows the customized cell value of the MonthCalendarAdv:

Shows the customized cell value

Samples:

C#: http://www.syncfusion.com/downloads/support/directtrac/135929/MonthCalendar_CellCustomization-486933793.zip

VB: http://www.syncfusion.com/downloads/support/directtrac/135929/MonthCalendar_CellCustomization_VB-1008281778.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon