I have a bound CalendarInfo for Appointments and Owners. The appointments are displayed in an UltraDayView. In one use case Users are not able to move, resie or Edit appointments in the UltraDayView I only wnat them to be able to select multiple appointments which then opens another screen where the user can do a next/ prev function to move through a person employess records for the Person that each one of the previously selected appointments relates to. I am useing the DataKey to hold the PersonId Key.
While the user can select multiple appointments it is very cumbersome to make them click seperately on each and every appointment to set its as being selected. I thought that clicking on an appointment and then pressing down the Shift Key and then the last appointment in teh day View that I want (say the first one is at 09:00 and the last one at 13:00 would select all the appointments in between 09:00 and 13:00 but it doesn't. The user is forced to click on each and every appointment starting at 09:00 and until 13:00. Is there someway that you can advise me of how to achieve this please? What is the benefit of extended under
With UltraCalendarInfo1 .AllowAllDayEvents = False .AllowRecurringAppointments = False 'Disallow RecurringAppointments .SelectTypeActivity = UltraWinSchedule.SelectType.Extended .EventManager.CalendarInfo.SelectTypeActivity = UltraWinSchedule.SelectType.Extended End WithThank you
Hello ,
In order to achieve selection of several appointments while shift key is pressed, you should determine the time frame for which appointment should be secleted and then to select the appointments in this time frame. The code will looks like :
Dim endDate As DateTime = UltraCalendarInfo1.SelectedAppointments.Cast(Of Infragistics.Win.UltraWinSchedule.Appointment).Max(Function(app) app.StartDateTime)
Dim startDate As DateTime = UltraCalendarInfo1.SelectedAppointments.Cast(Of Infragistics.Win.UltraWinSchedule.Appointment).Min(Function(app) app.StartDateTime)
UltraCalendarInfo1.SelectedAppointments.Clear()
Dim appList As List(Of Infragistics.Win.UltraWinSchedule.Appointment) = _
UltraCalendarInfo1.Appointments.Cast(Of Infragistics.Win.UltraWinSchedule.Appointment).Where(Function(app) app.OwnerKey = UltraDayView1.ActiveOwner.Key).Where(Function(selApp) selApp.StartDateTime >= startDate And selApp.StartDateTime <= endDate).ToList()
appList.ForEach(AddressOf SelectAppointment)
Also I have implemented my suggestion in a small sample. Please run the sample and let me know if this is what you are looking for.
Please let me know if you have any further questions.
Hi Hristo,
Thank you for your prompt reply. I cannot seem to find the sample that you have so kindly put together. Can you please re-attach it?
Regards and thanks
Stephen
Hello,
For some reason the sample was not attached, so i am attaching it again.
Thank you for using Infragistics Components.
HI Mike
Sorry that it has taken me a few days to get back to you. with this specified
Dim startDate As DateTime = UltraCalendarInfo1.SelectedAppointments.Cast(Of Appointment).Min(Function(app) app.StartDateTime)
the solution build fails unless I Import System.Linq which I didn't think was relevant and had been removed by a VS2015 remove unused References
Regards and Thanks
Stephen Kalyniuk said:fails to compile
Can you be more specific? What error message are you getting?
After loading Winforms 19.1, including the rebuild to release 19.1.20191.82 compiling on .Net framework 4.0 this line now fails to compile
Please advise
Thank you for your feedback. I am glad to hear that my code woks for you.
Thanks Hristo. You have been of great help to me with the example that you sent! I meant to update the post earlier.
Like you I also thought that is was a .Net 2 vs .Net 4 issue. However what actually overcame it was importing the System.Linq namespace
after which CAST appeared as a method in the SelectedAppointments object. It is working fine in my project now.