Hello,
I am using the xamSchedule control to display a list of appointments from a database based on which user has been selected. However, all of my programmatically created appointments come through on the calendar as white instead of the expected blue and they are unable to be dragged and manipulated. I assume that I am neglecting to bind something correctly or filling something incorrectly but I'm not sure where I'm going wrong. Here are my snippets and a screenshot:
XAML:
<ig:XamOutlookCalendarView Grid.Row="1" x:Name="outlookCalendarView" ShowWorkingHoursOnly="True" CurrentViewMode="{Binding ElementName=Data}" HeaderVisibility="Visible" CurrentViewModeChanged="outlookCalendarView_CurrentViewModeChanged" MouseDown="dayView_MouseDown" Grid.ColumnSpan="2"> <ig:XamOutlookCalendarView.DataManager> <ig:XamScheduleDataManager CurrentUserId="own1" x:Name="dataManager"> <ig:XamScheduleDataManager.Settings> <ig:ScheduleSettings WorkDays="Monday, Tuesday, Wednesday, Thursday, Friday" > <ig:ScheduleSettings.WorkingHours> <ig:WorkingHoursCollection> <ig:TimeRange Start="06:00" End="13:00" /> <ig:TimeRange Start="14:00" End="16:00" /> </ig:WorkingHoursCollection> </ig:ScheduleSettings.WorkingHours> </ig:ScheduleSettings> </ig:XamScheduleDataManager.Settings> <ig:XamScheduleDataManager.CalendarGroups> <ig:CalendarGroup InitialCalendarIds="own1"/> <ig:CalendarGroup InitialCalendarIds="own2"/> </ig:XamScheduleDataManager.CalendarGroups> <ig:XamScheduleDataManager.DataConnector> <ig:ListScheduleDataConnector ResourceItemsSource="{Binding Resources, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ResourceCalendarItemsSource="{Binding Calendars, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" AppointmentItemsSource="{Binding Appointments, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> </ig:XamScheduleDataManager.DataConnector> </ig:XamScheduleDataManager> </ig:XamOutlookCalendarView.DataManager> </ig:XamOutlookCalendarView>
C#:
Resources.Add(new Resource { Id = "own1", Name = driver1.Name }); ResourceCalendars.Add(new ResourceCalendar { Id = "cal1", OwningResourceId = "own1" });
foreach (Journey jrny in jrnys) { if (jrny.Template == false) { if (jrny.JourneyStatusId != (int)JourneyStatuses.Cancelled) { Appointment app = new Appointment(); app.Id = jrny.JourneyId.ToString() + "-" + calId; app.OwningResourceId = "own1"; app.OwningCalendarId = "cal1"; app.Subject = jrny.Description; app.DataItem = jrny; if (jrny.Stops.Count > 0) { if (jrny.JourneyDate != null) { app.Start = jrny.JourneyDate.Value.AddHours(jrny.Stops[0].ArrivalTime.Hours).AddMinutes(jrny.Stops[0].ArrivalTime.Minutes).ToUniversalTime(); app.End = jrny.JourneyDate.Value.AddHours(jrny.Stops[0].ArrivalTime.Hours).AddMinutes(jrny.Stops[0].ArrivalTime.Minutes + jrny.Stops[0].WaitTime).ToUniversalTime(); } } calId++; foreach (Stop stop in jrny.Stops) { if (stop.Passengers.Count > 0) { //app.Location = app.Location + stop.Passengers[0].Address.PostCode + "; "; app.Location = app.Location + stop.StopType.StopTypeName + " "; foreach (TransportableItem trans in stop.Passengers) { app.Location = app.Location + trans.Name + " "; } app.Location = app.Location + stop.Passengers[0].Address.Line1 + ", " + stop.Passengers[0].Address.PostCode + " at " + stop.ArrivalTime.ToString(); app.Location = app.Location + "." + System.Environment.NewLine; } } Appointments.Add(app); } } }
Screenshot:
Hello Josh,
Thank you for your post. I have been looking into it and I created a sample project for you following your scenario and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.
Hello Stefan,
From using your example as a base, I have managed to get it working correctly.
Thank you very much for your help!
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Hello Stefan.
I appreciate your opinion.Provisional correspondence, It corresponded with displayed separately in each of Calendar Appointments and Journals.Divide the Calendar, Background is different, so it is a little troubled.Although I hope can unify the Background for each the Resource.--;
Thanks
Sorry, I mistook the post destination.