Hello all,
I'm using Infragistics v11.2 controls, specifially an UltraDayView. I've created a custom context menu that allows a user to right-click and choose a timeslot or appointment that they want to add/edit/remove an appointment in. (Shown below...)
The trouble I'm having is that, using the following code, the "Edit" option doesn't correct pick up the appointment under the mouse. If I click in the same timeslot as when the appointment *starts*, in this case 10:45-11:00, the edit works fine. However, even though the appointment spans 10:45-11:45, if I click in another timeslot, for example 11:15-11:30, the selected appointment under the mouse returns as null or nothing. Here's my code:
Private Sub tsmiEditEntry_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tsmiEditEntry.Click Dim mousePoint = udvSchedule.PointToClient(Cursor.Position) Dim appt = udvSchedule.GetAppointmentFromPoint(mousePoint)
If appt IsNot Nothing Then uciMain_BeforeDisplayAppointmentDialog(Me, New DisplayAppointmentDialogEventArgs(appt, False)) End If End Sub
Does anyone know of something I can change in my code to correctly pick up the full extension of the appointment, or if this property exists somewhere on the UltraDayView?
Thanks!
Hello,
I believe that you would have to capture the cursor's position in the Opening event of your ContextMenu:
Point mousePoint; private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) { mousePoint = udvSchedule.PointToClient(Cursor.Position); }
Please do not hesitate to contact us if you need any additional assistance.