SchedulerViewBase.CalcHitInfo(Point) Method
Returns information on scheduler elements located at the specified point.
Namespace: DevExpress.Xpf.Scheduler
Assembly: DevExpress.Xpf.Scheduler.v18.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
point | Point | A Point structure which specifies the test point coordinates relative to the top left corner. |
Returns
Type | Description |
---|---|
DevExpress.Xpf.Scheduler.SchedulerControlHitInfo | A DevExpress.Xpf.Scheduler.SchedulerControlHitInfo object which contains information about scheduler elements located at the test point. |
Remarks
Important
You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.
This example demonstrates how to obtain the hit information for the scheduler element over which the mouse pointer is hovering.
To accomplish this, handle the SchedulerControl.MouseMove event and use the SchedulerViewBase.CalcHitInfo method to get the required information.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-determine-which-scheduler-element-is-hovered-by-the-mouse-pointer-t151373.
Private Sub SchedulerControl_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
' Obtain hit information under the test point.
Dim hitInfo As SchedulerControlHitInfo = schedulerControl1.ActiveView.CalcHitInfo(e)
Dim builder As New StringBuilder()
' Check whether the scheduler element is located at the test point.
Select Case hitInfo.HitTest
Case SchedulerHitTest.AllDayArea
builder.AppendLine("All-Day Area")
Case SchedulerHitTest.AppointmentContent
builder.AppendLine("Appointment")
Dim appView As IAppointmentView = TryCast(hitInfo.ViewInfo, IAppointmentView)
If appView IsNot Nothing Then
builder.AppendLine("Subject: " & appView.Appointment.Subject)
builder.AppendLine("Start: " & appView.Appointment.Start.ToString())
builder.AppendLine("End: " & appView.Appointment.End.ToString())
End If
Case SchedulerHitTest.Cell
builder.AppendLine("Time Cell")
End Select
If builder.Length > 0 Then
builder.AppendLine("Interval: " & hitInfo.ViewInfo.Interval.ToString())
builder.AppendLine("Is Selected? " & hitInfo.ViewInfo.Selected.ToString())
lbl1.Content = String.Format("Hit test results:" & ControlChars.Lf & builder.ToString())
Else
lbl1.Content = "Move the mouse pointer over the scheduler" & ControlChars.Lf & " to get information on the element which is hovered over."
End If
End Sub
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CalcHitInfo(Point) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.