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 : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the MonthCalendarAdv dates as Bolded dates?

User can customize the font style of specific dates as Bold. It can be achieved by handling DateQueryCellInfo event. Here we have added the required bolded dates in BoldDateTime list, then check its value with MonthCalenderAdv date cell value in DateQueryCellInfo event. If date value matched, font style of corresponding date changed to bold. The following code demonstrates the same.

 

Code Example: [C#]

 

private List<DateTime> BoldDateTime = new List<DateTime>();

 

//Raise the event for Date cell customization

this.monthCalendarAdv1.DateCellQueryInfo += MonthCalendarAdv1_DateCellQueryInfo;

 

//Add Bold date

BoldDateTime.Add(DateTime.Now.AddDays(+1));

BoldDateTime.Add(DateTime.Now.AddDays(+2));

BoldDateTime.Add(DateTime.Now.AddDays(+3));              

BoldDateTime.Add(DateTime.Now.AddDays(-1));

BoldDateTime.Add(DateTime.Now.AddDays(-2));

 

private void MonthCalendarAdv1_DateCellQueryInfo(object sender, Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs e)

{

 

/// <summary>

/// check date value is equal for added bold date value

/// If yes, it shows the date value as bold

/// </summary>

 

if (e.DateValue != null && (!BoldDateTime.Contains(Convert.ToDateTime(e.DateValue))))

{

for (int i = 0; i < BoldDateTime.Count; i++)

{

if (this.BoldDateTime[i].Date.ToString() == e.DateValue.ToString())

{

 

//enable Bold

 

e.Style.Font.Bold = true;

 

}

}

}

}

 

Code Example: [VB]

 

Private BoldDateTime As New List(Of Date)()

 

'Raise the event for Date cell customization

 

AddHandler Me.monthCalendarAdv1.DateCellQueryInfo, AddressOf MonthCalendarAdv1_DateCellQueryInfo

 

'Add Bold date

 

BoldDateTime.Add(Date.Now.AddDays(+1))

BoldDateTime.Add(Date.Now.AddDays(+2))

BoldDateTime.Add(Date.Now.AddDays(+3))

BoldDateTime.Add(Date.Now.AddDays(-1))

BoldDateTime.Add(Date.Now.AddDays(-2))

 

Private Sub MonthCalendarAdv1_DateCellQueryInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs)

 

''' <summary>

''' check date value is equal for added bold date value

''' If yes, it shows the date value as bold

''' </summary>

 

If e.DateValue IsNot Nothing AndAlso (Not BoldDateTime.Contains(Convert.ToDateTime(e.DateValue))) Then

For i As Integer = 0 To BoldDateTime.Count - 1

If Me.BoldDateTime(i).Date.ToString() = e.DateValue.ToString() Then

 

'enable Bold

 

e.Style.Font.Bold = True

 

End If

Next i

End If

End Sub

 

Screenshot

 

 

Sample:

 

C#:  MonthCalendarSample

 

VB:  MonthCalendarSample

 

Article ID: Published Date: Last Revised Date: Platform: Control:
8805 05/31/2018 05/31/2018 WinForms MonthCalendarAdv
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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