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
Sorry but I still cannot see the attachment
Can I use
Dim endDate As DateTime = UltraCalendarInfo1.SelectedAppointments.Item(0).EndDateTime Dim startDate As DateTime = UltraCalendarInfo1.SelectedAppointments.Item(0).StartDateTimefor the start and end dates?I am using VB.net and the statements that you provided wont compile. typeof is not working and 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() results in a message that states Cast is not a member of UltraCalendarInfo1.Appointments.Caststill cannot see example
Hello,
The attachment is below my signature
“Infragistics, Inc.
99932.zip”
So please click on “99932.zip” of my previous post in order to download the sample.
Thank you I have the file now. When I can get this to work in my own project it looks like this will be okay (thanks very much).
However I keep getting the error message that CAST IS NOT A MEMBER OF Infragistics.Win.UltraWinSchedule.AppointmentsCollection in my own project but its fine in yours
Any ideas why this would be happening as I just can't figure it out? Thanks for any help
Regards
It seems that your project is designed on .NET 2.0 and for this reason you are not able to use Cast(). So you should change TargetFrameWork of your application to “.NET Framework 4 Client Profile”. On the following link you will find a tutorial how to do his for VB project.
http://weblogs.asp.net/jeffwids/archive/2009/12/29/how-to-change-the-target-framework-version-for-a-visual-basic-project.aspx
I hope that this will helps you.
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.
Thank you for using Infragistics Components.
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.