Class ScheduleGrid
A ScheduleGrid class illustrates the grid that holds the schedule items, possibly for multiple days.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Schedule
Assembly: Syncfusion.Schedule.Windows.dll
Syntax
public class ScheduleGrid : GridControl, IDisposable, ICancelModeProvider, ISplitterPaneSupport, IScrollBarWrapperContainer, ISupportUpdating, ISupportIntelliMouse, IQueryFocusInside, INonClientPaintingSupport, IThemedControl, ICreateNewWindow, IGridModelSource, IGridWindowlessSite, IGridWindowlessObject, IFindParentForm, IThemeProvider, ISupportInitialize, IVisualStyle
Remarks
ScheduleGrid is a GridControl derived class that serves as the container for the schedule items being displayed. Depending upon the ScheduleViewType being displayed, this grid may show a single day's items or multiple days' items. It has class members to reference the navigation calendars.
Constructors
ScheduleGrid()
Initializes a new instance of the ScheduleGrid class.
Declaration
public ScheduleGrid()
ScheduleGrid(NavigationCalendar, ScheduleControl, DateTime)
Initializes a new instance of the ScheduleGrid class.
Declaration
public ScheduleGrid(NavigationCalendar calendar, ScheduleControl schedule, DateTime theDate)
Parameters
| Type | Name | Description |
|---|---|---|
| NavigationCalendar | calendar | The Calendar used to determine the dates displayed. |
| ScheduleControl | schedule | Gets the ScheduleControl that hosts this ScheduleGrid. |
| System.DateTime | theDate | The date used to set the initial display. |
Fields
DisplayItemFormatStrings
Strings that are used to define the text that is displayed in the ScheduleControl.
Declaration
public string[] DisplayItemFormatStrings
Field Value
| Type |
|---|
| System.String[] |
Remarks
You can control the information that is displayed within a cell within a schedule control by setting properties like: AllDayItemFormat, WeekMonthItemFormat and DayItemFormat. DisplayItemFormatStrings holds the token codes that you can use to represent the format string. Here is a list of the supported tokens and what they represent froma an IScheduleAppointment: [end] IScheduleAppointment.EndTime (both date and time) [label] IScheduleAppointment.LabelValue [location] IScheduleAppointment.LocationValue [marker] IScheduleAppointment.MarkerValue [owner] IScheduleAppointment.Owner [reminder] IScheduleAppointment.Reminder [subject] IScheduleAppointment.Subject [start] IScheduleAppointment.StartTime (both date and time) [allday] IScheduleAppointment.AllDay (true or false) [starttime] IScheduleAppointment.StartTime (time only) [endtime] IScheduleAppointment.EndTime (time only) [startdate] IScheduleAppointment.StartTime (date only) [enddate] IScheduleAppointment.EndTime (date only) [content] IScheduleAppointment.Content
To include a [ or a ] within your formatted string, use [[ and ]] to represent the single bracket.
Examples
Here is some sample code.
//display only subject in weekly view
scheduleControl1.WeekMonthItemFormat = "[subject]";
//display only subject and time in weekly view
scheduleControl1.WeekMonthItemFormat = "[subject] [starttime]";
//display time Re:subject in weekly view
scheduleControl1.WeekMonthItemFormat = "[starttime] Re:[subject]";
'display only subject in weekly view
scheduleControl1.WeekMonthItemFormat = "[subject]"
'display only subject and time in weekly view
scheduleControl1.WeekMonthItemFormat = "[subject] [starttime]"
'display time Re:subject in weekly view
scheduleControl1.WeekMonthItemFormat = "[starttime] Re:[subject]"
DisplayStrings
Holds various strings used in the ScheduleGrid control.
Declaration
public static string[] DisplayStrings
Field Value
| Type |
|---|
| System.String[] |
Remarks
You can change the strings used on the ScheduleGrid by changing the values in this string array.
Examples
Here are the default values of this string array.
public static string[] DisplayStrings = new string[]
{
"no closing delimiter error", // 0
"(none)", // 1
"Week starting ", // 2
"Starting ", // 3
" Double Click to Add All Day Event", // 4
"To ", //5
"From ", //6
"Remove this appointment?", //7
"Remove Appointment", //8
"&New Item", //9
"New &All Day item", //10
"&Edit Item", //11
"De&lete Item", //12
"&Day", //13
"&Work Week", //14
"Wee&k", //15
"&Month" //16
"Click to switch to Day view" //17
};
MaxLimitOnDisplayDays
Maximum number of days displayable as a ScheduleViewType.CustomWeek display.
Declaration
[ThreadStatic]
public int MaxLimitOnDisplayDays
Field Value
| Type |
|---|
| System.Int32 |
Remarks
If you select more days than this limit, the latter selections will be ignored.
Properties
Calendar
Gets the NavigationCalendar used to determine the dates displayed.
Declaration
public NavigationCalendar Calendar { get; }
Property Value
| Type |
|---|
| NavigationCalendar |
CharLength
Used internally. Gets or sets the number of bytes used for a single character.
Declaration
public virtual int CharLength { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
DataSource
Gets or sets the IScheduleDataProvider data source for this ScheduleControl.
Declaration
public IScheduleDataProvider DataSource { get; set; }
Property Value
| Type |
|---|
| IScheduleDataProvider |
EnableTouchMode
Gets or sets the touch mode.
Declaration
public virtual bool EnableTouchMode { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
MinimumGridRowHeight
Gets or sets the minimum row height in a Day, WorkWeek or Custom view.
Declaration
public static int MinimumGridRowHeight { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
MoreItemsBitmap
Gets the bitmap drawn when day on a Week or Month ScheduleViewType has more items than can be displayed in the grid cell for that day.
Declaration
public static Bitmap MoreItemsBitmap { get; }
Property Value
| Type |
|---|
| System.Drawing.Bitmap |
Schedule
Gets the ScheduleControl that hosts this ScheduleGrid.
Declaration
public ScheduleControl Schedule { get; }
Property Value
| Type |
|---|
| ScheduleControl |
ScheduleType
Gets or sets the whether a daily, weekly or monthly schedule is displayed.
Declaration
public ScheduleViewType ScheduleType { get; set; }
Property Value
| Type |
|---|
| ScheduleViewType |
SelectedAppointments
Gets the IScheduleAppointment selected appointments collections.
Declaration
public List<IScheduleAppointment> SelectedAppointments { get; }
Property Value
| Type |
|---|
| System.Collections.Generic.List<IScheduleAppointment> |
SpanOnlyPrimeTime
Gets or sets a value indicating whether appointments that span multiple days should only appear during prime time.
Declaration
public static bool SpanOnlyPrimeTime { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Methods
ApplyScaleToControl(Single)
Applies the scaling.
Declaration
public void ApplyScaleToControl(float sf)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | sf | The value for scaling. |
CheckSpanOnlyPrimeTime()
Changes the currently loaded span appointments start/end time with respect to SpanOnlyPrimeTime property at runtime.
Declaration
protected virtual void CheckSpanOnlyPrimeTime()
DisplayRecurringAppointmentEditConfirmation()
Displays a dialog to determine the specific action desired by the user when a recurring appointment is edited.
Declaration
public virtual RecurringAppointmentEditAction DisplayRecurringAppointmentEditConfirmation()
Returns
| Type | Description |
|---|---|
| RecurringAppointmentEditAction | A RecurringAppointmentEditAction value. |
Dispose(Boolean)
Cleans up any resources being used.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Overrides
DrawRoundRect(Single, Single, Single, Single, Single)
Draws rounded rectangle specified by a co-ordinate pair, width, height and radius.
Declaration
public static GraphicsPath DrawRoundRect(float X, float Y, float width, float height, float radius)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | X | X co-ordinate. |
| System.Single | Y | Y co-ordinate. |
| System.Single | width | Width of the rectangle. |
| System.Single | height | Height of the rectangle. |
| System.Single | radius | Radius of the rounded corners. |
Returns
| Type | Description |
|---|---|
| System.Drawing.Drawing2D.GraphicsPath | The GraphicsPath object for the rounded rectangle. |
GetBitmap(String)
Gets the bitmap drawn.
Declaration
public static Bitmap GetBitmap(string bmpName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | bmpName | Name of the bitmap. |
Returns
| Type | Description |
|---|---|
| System.Drawing.Bitmap | The bitmap drawn. |
GetFormattedString(DateTime, String)
Gets a date formatted as a MMMM d, yyyy that is displayed in a Month view.
Declaration
public virtual string GetFormattedString(DateTime dt, string format)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTime | dt | The given date. |
| System.String | format | The string that provides the format. |
Returns
| Type | Description |
|---|---|
| System.String | The formatted string. |
GetTimeDisplayText(Int32)
Gets the time string to be displayed in the time column.
Declaration
protected virtual string GetTimeDisplayText(int rowIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowIndex | Grid row index, normally 2 through 50. |
Returns
| Type | Description |
|---|---|
| System.String | The string to be displayed. Characters after | will be displayed in small text. |
OnCellCursor(GridCellCursorEventArgs)
Overridden to show drop cursor while moving an appointment in a Month or Week display.
Declaration
protected override void OnCellCursor(GridCellCursorEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridCellCursorEventArgs | e | The GridCellCursorEventArgs that contains the event data. |
Overrides
OnClick(EventArgs)
Overridden to set the date value in navigation calendar.
Declaration
protected override void OnClick(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnDrawCellDisplayText(GridDrawCellDisplayTextEventArgs)
Overridden to support displaying appointments with rounded corners
Declaration
protected override void OnDrawCellDisplayText(GridDrawCellDisplayTextEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridDrawCellDisplayTextEventArgs | e | The System.EventArgs that contains the event data. |
Overrides
OnGridSetUpCompleted(EventArgs)
Raises the GridSetUpCompleted event.
Declaration
protected virtual void OnGridSetUpCompleted(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e | The System.EventArgs that contains the event data. |
OnMouseLeave(EventArgs)
Overridden to disable the the display of ToolTip as the user leaves mouse pointer out of an IScheduleAppointment.
Declaration
protected override void OnMouseLeave(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e | The event arguments. |
Overrides
OnMouseMove(MouseEventArgs)
Overridden to manage tooltip that displays IScheduleAppointment information as the user hovers the mouse over an item.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.MouseEventArgs | e | The event arguments. |
Overrides
OnMouseWheel(MouseEventArgs)
Handles mouse wheel processing. When EnableTouchMode was enabled and modifier key is control, then perform zoom operation.
Declaration
protected override void OnMouseWheel(MouseEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.MouseEventArgs | e | A System.Windows.Forms.MouseEventArgs that contains the event data. |
Overrides
OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs)
Used to change the default behavior of the OnPrepareViewStyleInfo event
Declaration
protected override void OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridPrepareViewStyleInfoEventArgs | e | The GridPrepareViewStyleInfoEventArgs that contains the event data. |
Overrides
OnQueryCellInfo(GridQueryCellInfoEventArgs)
Overridden to support the appointment being displayed with rounded corners.
Declaration
protected override void OnQueryCellInfo(GridQueryCellInfoEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| GridQueryCellInfoEventArgs | e | The GridQueryCellInfoEventArgs that contains the event data. |
Overrides
OnScheduleAppointmentClick(ScheduleAppointmentClickEventArgs)
Raises the ScheduleAppointmentClick event.
Declaration
public virtual void OnScheduleAppointmentClick(ScheduleAppointmentClickEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| ScheduleAppointmentClickEventArgs | e | The ScheduleAppointmentClick that contains the event data. |
OnSetDefaultItemProperties(IScheduleAppointment)
Sets initial default values on a schedule item and raises the SetDefaultItemProperties event to allow listeners the option of setting default values.
Declaration
protected virtual void OnSetDefaultItemProperties(IScheduleAppointment item)
Parameters
| Type | Name | Description |
|---|---|---|
| IScheduleAppointment | item | The ScheduleAppointmentEventArgs holding the proposed current value of the schedule item. |
OnShowingAdvancedToolTip(ScheduleGrid.ShowingAdvancedTooltipEventArgs)
Raises the ShowingAdvancedToolTip event.
Declaration
public virtual void OnShowingAdvancedToolTip(ScheduleGrid.ShowingAdvancedTooltipEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| ScheduleGrid.ShowingAdvancedTooltipEventArgs | e | The ScheduleGrid.ShowingAdvancedTooltipEventArgs that contains the event data. |
OnShowingAppointmentForm(ShowingAppointFormEventArgs)
Raises the ShowingAppointmentForm event.
Declaration
protected virtual void OnShowingAppointmentForm(ShowingAppointFormEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| ShowingAppointFormEventArgs | e | The ShowingAppointFormEventArgs that contains the event data. |
OnSizeChanged(EventArgs)
Overridden to center text at the top of the grid.
Declaration
protected override void OnSizeChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e | The System.EventArgs that contains the event data. |
Overrides
OnTouchPan(Point, Boolean)
Perform the horizontal panning operation by moving the next view or previous view, otherwise do the vertical panning operation by calling the base method.
Declaration
protected override bool OnTouchPan(Point currentTouchPoint, bool isSwipeScroll)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Point | currentTouchPoint | Current touch position |
| System.Boolean | isSwipeScroll | used to decide the swipe scrolling operation occurs |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns false if view was changed with horizontal panning operation, otherwise calls the base method |
Overrides
OnTouchPanBegin(Point)
Save the touch starting position when begin the touch panning operation.
Declaration
protected override bool OnTouchPanBegin(Point touchBeginPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Point | touchBeginPoint | touch position when panning operation start |
Returns
| Type |
|---|
| System.Boolean |
Overrides
ParentFormClosing(Object, CancelEventArgs)
A method to commit changes while closing parent control.
Declaration
public virtual void ParentFormClosing(object sender, CancelEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | Parent Form |
| System.ComponentModel.CancelEventArgs | e | A System.ComponentModel.CancelEventArgs with event data. |
ParseDisplayItem(IScheduleAppointment, String)
Gets a string containing information on the IScheduleAppointment.
Declaration
public virtual string ParseDisplayItem(IScheduleAppointment item, string format)
Parameters
| Type | Name | Description |
|---|---|---|
| IScheduleAppointment | item | The IScheduleAppointment. |
| System.String | format | The format string containing tokens from DisplayItemFormatStrings. |
Returns
| Type | Description |
|---|---|
| System.String | A formatted string. |
Examples
Here is a code snippet that returns a string holding the start time and subject of someItem separated by a comma.
//Get a string holding the start time and subject
string s = scheduleControl1.GetScheduleHost().ParseDisplayItem(someItem, "[starttime],[subject]");
'Get a string holding the start time and subject
Dim s as string = ScheduleControl1.GetScheduleHost().ParseDisplayItem(someItem, "[starttime],[subject]")
SetDataToDayPanels()
Gets IScheduleAppointments from the IDateProvider based on the parameters passed in through the ScheduleGrid constructor and uses these IScheduleAppointments to populate this ScheduleGrid with day panels.
Declaration
public void SetDataToDayPanels()
SetHeaderLabel()
Initializes the labels from DisplayStringsthat appear in headers of the ScheduleGrid.
Declaration
public void SetHeaderLabel()
Remarks
Call this method after you make any modifications to DisplayStrings to make the ScheduleGrid use the modified DisplayStrings.
SetupChildControls()
Initializes the ScheduleGrid through its GridControl properties and events.
Declaration
public void SetupChildControls()
Remarks
This methods initializes to various GridControl properties, cell types and mouse controllers to support the functionality in ScheduleGrid.
ShowAppointmentForm(IScheduleAppointment, Boolean, Int32)
Displays a form that allows the user to edit an appointment.
Declaration
public virtual void ShowAppointmentForm(IScheduleAppointment item, bool existingItem, int panel)
Parameters
| Type | Name | Description |
|---|---|---|
| IScheduleAppointment | item | The appointment to be edited. |
| System.Boolean | existingItem | True if the item being edited already existed. |
| System.Int32 | panel | An integer that provides the 0-based index of the day if the ScheduleViewType is a Day, WorkWeek or Custom. If the view type is some other value, panel is ignored. |
SwitchTo(ScheduleViewType, Boolean)
A method that switches the display to the requested ScheduleViewType.
Declaration
public void SwitchTo(ScheduleViewType t, bool force)
Parameters
| Type | Name | Description |
|---|---|---|
| ScheduleViewType | t | The ScheduleViewType. |
| System.Boolean | force | Whether or not the display should be reset if the current ScheduleViewType is the same as the requested ScheduleViewType. |
UpdateScrollBars()
Overridden to make sure no horizontal scrollbar is seen after sizing...
Declaration
public override void UpdateScrollBars()
Overrides
Events
GridSetUpCompleted
Occurs when the GridControl that displays the multiple day panels has completed its formatting and has been populated.
Declaration
public event EventHandler GridSetUpCompleted
Event Type
| Type |
|---|
| System.EventHandler |
Remarks
This event is an notification event that this GridControl has been fully initialized. At this point, you can modify any of the GridControl's standard properties, and your change will take precedence over the existing settings.
ScheduleAppointmentClick
Occurs when you click/double click an item.
Declaration
public event ScheduleAppointmentClickEventHandler ScheduleAppointmentClick
Event Type
| Type |
|---|
| ScheduleAppointmentClickEventHandler |
SetDefaultItemProperties
Allows you to set the default properties on a new schedule items.
Declaration
public event ScheduleAppointmentChangedEventHandler SetDefaultItemProperties
Event Type
| Type |
|---|
| ScheduleAppointmentChangedEventHandler |
ShowingAdvancedToolTip
Occurs when advanced tool tip is shown.
Declaration
public event ScheduleGrid.ShowingAdvancedToolTipEventHandler ShowingAdvancedToolTip
Event Type
| Type |
|---|
| ScheduleGrid.ShowingAdvancedToolTipEventHandler |
Explicit Interface Implementations
IVisualStyle.VisualTheme
Declaration
string IVisualStyle.VisualTheme { get; set; }
Returns
| Type |
|---|
| System.String |