I have used the xamScheduleView to display the following view (see attached). However am not able to see the resource i.e. (Amanda and Deven) in the UI.
The code that it used is as under:
//add a resources list with one resource inside
var resources = new ObservableCollection<Resource>();resources.Add(new Resource{Id = "own1",Name = "Amanda",IsVisible = true});
resources.Add(new Resource{Id = "own2",Name = "Deven",IsVisible = true});
//Create a resource calendar list with one calendar inside//Note that the owning resource id of the calendar is the same as the id of the resource created in the previous step. var calendars = new ObservableCollection<ResourceCalendar>();calendars.Add(new ResourceCalendar{Id = "cal1",OwningResourceId = "own1"});
calendars.Add(new ResourceCalendar{Id = "cal2",OwningResourceId = "own2"});
//Create a list of appointments with three items inside://Note that the appointments' resource id is the same as the resources defined, and the calendar id is the same as the calendar defined in step 5. var appointments = new ObservableCollection<Appointment>();
appointments.Add(new Appointment{Id = "t1",OwningCalendarId = "cal1",OwningResourceId = "own1",Subject = "Appointment 1",Description = "My first appointment",Start = DateTime.Today.AddHours(1).ToUniversalTime(),End = DateTime.Today.AddHours(2).ToUniversalTime()});
appointments.Add(new Appointment{Id = "t2",OwningCalendarId = "cal1",OwningResourceId = "own1",Subject = "Appointment 2",Description = "My second appointment",Start = DateTime.Today.AddHours(3).ToUniversalTime(),End = DateTime.Today.AddHours(4).ToUniversalTime()});
appointments.Add(new Appointment{Id = "t3",OwningCalendarId = "cal2",OwningResourceId = "own2",Subject = "Appointment 3",Description = "My third appointment",Start = DateTime.Today.AddHours(5).ToUniversalTime(),End = DateTime.Today.AddHours(6).ToUniversalTime()});
//Create a xamSchedule Data Connector and attach the list of resources, calendars and appointments to it:
ListScheduleDataConnector scheduleDataConnector =new ListScheduleDataConnector();
scheduleDataConnector.ResourceItemsSource = resources;scheduleDataConnector.ResourceCalendarItemsSource = calendars;scheduleDataConnector.AppointmentItemsSource = appointments;
//Create a xamSchedule Data manager and attach the Data Connector to it: XamScheduleDataManager scheduleDataManager = new XamScheduleDataManager();scheduleDataManager.DataConnector = scheduleDataConnector;
//Create a calendar group and set the initial calendar: CalendarGroupCollection calGroups = scheduleDataManager.CalendarGroups;
CalendarGroup calGroup = new CalendarGroup();calGroup.InitialCalendarIds = "own1[cal1],own2[cal2]";calGroup.InitialSelectedCalendarId = "own1[cal1]";calGroups.Add(calGroup);
//Finally create a xamSchedule DayView, attach the data manager to it
//XamDayView xamDayView1 = new XamDayView();
xamScheduleView1.DataManager = scheduleDataManager;
//this.PageRoot.Children.Add(xamDayView1);
However the resource names are displayed. Can somebody please help...
Hi,
If you want to see the names in the XamScheduleView, you should set the Name property of the ResourceCalendar.
Thanks,
Diyan Dimitrov