Class NavigationCalendar
A class to display one or more calendars that can be used to select particular dates or date ranges to be displayed in the ScheduleControl.
Inheritance
Implements
Namespace: Syncfusion.Windows.Forms.Schedule
Assembly: Syncfusion.Schedule.Windows.dll
Syntax
public class NavigationCalendar : Panel, ISupportInitialize
Remarks
This class has DateValueChanging and DateValueChanged events that let you listen for changes in the date that determines which month is displayed in the top-most calendar. As you size this control, additional calendars with subsequent months will be displayed, allowing your user to see multiple months in this navigation tool.
Constructors
NavigationCalendar()
Initializes a new instance of the NavigationCalendar class.
Declaration
public NavigationCalendar()
Remarks
NavigationCalendar is derived Panel that displays multiple calendars using a GridControl. You can use a derived GridControl by overriding the CreateCalendarGrid method and returning an instance of your derived GrodControl.
Fields
isCurrentMonth
True if the current month is available in the scheduler
Declaration
public bool isCurrentMonth
Field Value
Type |
---|
System.Boolean |
Properties
BottomRightDate
Gets the date value in the bottom-rightmost active-month cell of the navigation control.
Declaration
public DateTime BottomRightDate { get; }
Property Value
Type |
---|
System.DateTime |
CalenderGrid
Gets the GridControl that is used to display the calendars.
Declaration
public GridControl CalenderGrid { get; }
Property Value
Type | Description |
---|---|
GridControl | The GridControl. |
Remarks
Use this method to access the GridControl used for the calendars. For examples, you can get the date in the top-left most cell with this code.
Examples
The following code changes border information for cells:
//row 2 is the first row holding dates in the display grid
DateTime dt = (DateTime) this.CalenderGrid[2,1].CellValue;
'row 2 is the first row holding dates in the display grid
Dim dt as DateTime = Me.CalenderGrid(2,1).CellValue
DateValue
Gets or sets the date value for the navigation control.
Declaration
public DateTime DateValue { get; set; }
Property Value
Type |
---|
System.DateTime |
Remarks
This value is used to determine the month displayed in the topmost calendar (and hence the other calendars as well.) Before this value changes, the cancelable DateValueChanging is raised.
SelectedDates
Gets the DateSelections collection, holding the dates selected in the navigation calendars.
Declaration
public DateSelections SelectedDates { get; }
Property Value
Type |
---|
DateSelections |
ShowWeekNumbers
Gets or sets a value indicating whether week numbers should be displayed to the left of the navigation calendars.
Declaration
public bool ShowWeekNumbers { get; set; }
Property Value
Type |
---|
System.Boolean |
Today
Gets or sets the DateTime value of the current day.
Declaration
public DateTime Today { get; set; }
Property Value
Type |
---|
System.DateTime |
Remarks
By default, this value is set to DateTime.MinValue. When Today is DateTime.MinValue, the Today is not marked in the navigation calendars.
TopLeftDate
Gets the date value in the top-left cell of the navigation control.
Declaration
public DateTime TopLeftDate { get; }
Property Value
Type |
---|
System.DateTime |
Methods
AdjustSelectionsByMonth(Int32)
Shifts the selected dates by month offsets.
Declaration
public void AdjustSelectionsByMonth(int offSet)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | offSet | The number of months by which the dates in SelectedDates will be adjusted. |
BeginInit()
Empty ISupportInitialize.BeginInit implementation
Declaration
public void BeginInit()
BeginUpdate()
Suspends the drawing of this NavigationCalendar instance.
Declaration
public void BeginUpdate()
CreateCalendarGrid()
Creates the new instance for calendar grid.
Declaration
public virtual GridControl CreateCalendarGrid()
Returns
Type | Description |
---|---|
GridControl | The GridControl used to display the calendars. |
Remarks
Override this method to make this control use an instance of your derived GridControl class.
EndInit()
Empty ISupportInitialize.EndInit implementation
Declaration
public void EndInit()
EndUpdate()
Resumes drawing of this NavigationCalendar instance.
Declaration
public void EndUpdate()
FirstDayOfMonth(DateTime)
Gets the date of the first day of month of the passed-in date.
Declaration
public DateTime FirstDayOfMonth(DateTime dt)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dt | The date passed-in. |
Returns
Type | Description |
---|---|
System.DateTime | The first day of the month containing the passed-in date. |
MondayBeforeDate(DateTime)
Gets the date of the Monday prior to the passed-in date.
Declaration
public DateTime MondayBeforeDate(DateTime dt)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dt | The date passed-in. |
Returns
Type | Description |
---|---|
System.DateTime | The date of the Monday prior to the passed-in date. |
OnDateValueChanged()
Raises a notification event that the DateValue has changed.
Declaration
protected virtual void OnDateValueChanged()
OnDateValueChanging(DateTime, DateTime)
Raises a cancelable event before a change to DateValue occurs.
Declaration
protected virtual bool OnDateValueChanging(DateTime oldValue, DateTime newValue)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | oldValue | Existing value of DateValue |
System.DateTime | newValue | Proposed value of DateValue |
Returns
Type | Description |
---|---|
System.Boolean | Whether or not the change should take place. |
OnSizeChanged(EventArgs)
Overridden to set the position of GridControl in the panel.
Declaration
protected override void OnSizeChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
SetDateValue(DateTime)
Sets the value of the DateValue property without raising DateValueChanging or DateValueChanged events.
Declaration
public void SetDateValue(DateTime dt)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dt | The new date value. |
Remarks
The property DateValue is used to determine the Month that appears in the top most calendar. All other dates in the calendars are determines by this month. This method allows the DateValue value to change without raising the normal change events.
SundayAfterDate(DateTime)
Gets the Sunday after the given date.
Declaration
public DateTime SundayAfterDate(DateTime dt)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dt | The date passed-in. |
Returns
Type | Description |
---|---|
System.DateTime | The Sunday following the given date. |
Events
DateValueChanged
A notification event raised after the DateValue property changed.
Declaration
public event DateValueChangedEventHandler DateValueChanged
Event Type
Type |
---|
DateValueChangedEventHandler |
DateValueChanging
A cancelable event raised before the DateValue property changes.
Declaration
public event DateValueChangingEventHandler DateValueChanging
Event Type
Type |
---|
DateValueChangingEventHandler |