ISchedulerHitInfo Interface
Contains information about a specific point within a scheduler.
Namespace: DevExpress.Xpf.Scheduling
Assembly: DevExpress.Xpf.Scheduling.v19.1.dll
Declaration
Related API Members
The following members return ISchedulerHitInfo objects:
Remarks
ISchedulerHitInfo objects can be created by calling the scheduler view’s SchedulerControl.CalcHitInfo method. This method requires the test point passed as a parameter, or its coordinates.
The ISchedulerHitInfo implements the following properties which provide the capability to obtain information about a specific point within a scheduler.
- The ISchedulerHitInfo.HitTestType property identifies the type of the topmost element located under the test point;
- The ISchedulerHitInfo.ViewModel property provides view information on the selected view model.
Example
The following code snippet shows how to use the SchedulerControl.CalcHitInfo method in the Scheduler.MouseMove event handler to obtain the hit information for the scheduler element over which the mouse pointer is hovering. The information on the element located under the mouse pointer is shown in the top panel.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-determine-the-scheduler-element-hovered-by-the-mouse-pointer-t558570.
private void SchedulerControl_MouseMove(object sender, MouseEventArgs e)
{
// Obtain hit information under the test point.
Point position = e.GetPosition(schedulerControl1);
ISchedulerHitInfo hitInfo = schedulerControl1.CalcHitInfo(position);
if (hitInfo != null) {
this.hitResultsHeader.Text = "Hit Test Results";
StringBuilder builder = new StringBuilder();
builder.AppendLine(Enum.GetName(typeof(SchedulerHitTestType), hitInfo.HitTestType));
switch (hitInfo.HitTestType) {
case SchedulerHitTestType.Appointment:
AppointmentViewModel appViewModel = hitInfo.ViewModel as AppointmentViewModel;
if (appViewModel != null) {
builder.AppendLine("Subject: " + appViewModel.Appointment.Subject);
builder.AppendLine("Start: " + appViewModel.Appointment.Start.ToString());
builder.AppendLine("End: " + appViewModel.Appointment.End.ToString());
}
break;
case SchedulerHitTestType.Cell:
builder.AppendLine("Interval: " + hitInfo.ViewModel.Interval.ToString());
builder.AppendLine("Selected: " + hitInfo.ViewModel.IsSelected.ToString());
break;
case SchedulerHitTestType.Ruler:
TimeRulerCellViewModel rulerViewModel = hitInfo.ViewModel as TimeRulerCellViewModel;
if (rulerViewModel != null) {
builder.AppendLine("Time: " + rulerViewModel.Time.ToString());
builder.AppendLine("Time Scale: " + rulerViewModel.TimeScale.ToString());
}
break;
}
this.hitResultsText.Text = builder.ToString();
}
else {
ClearResults();
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ISchedulerHitInfo interface.
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.