Skip to main content

SchedulerViewBase.CalcHitInfo(MouseEventArgs) Method

Returns information on scheduler elements located at the specified point.

Namespace: DevExpress.Xpf.Scheduler

Assembly: DevExpress.Xpf.Scheduler.v21.2.dll


public SchedulerControlHitInfo CalcHitInfo(
    MouseEventArgs e


Name Type Description
e MouseEventArgs

A MouseEventArgs object providing data for mouse related routed events.


Type Description

A DevExpress.Xpf.Scheduler.SchedulerControlHitInfo object which contains information about scheduler elements located at the test point.



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.

View Example

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
            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())
        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
See Also