Hi,I'm testing the 20days trial to decide to buy or not the ultimate suite.I've a problem to define a custom Appointment dialog using XamlScheduleView.I've defined:
class MyScheduleDialogFactory : ScheduleDialogFactoryBase { public override ActivityTypes SupportedActivityDialogTypes { get { return ActivityTypes.Appointment; } }
public override FrameworkElement CreateActivityDialog(FrameworkElement container, XamScheduleDataManager dataManager, ActivityBase activity, bool allowModifications, bool allowRemove) { switch (activity.ActivityType) { case ActivityType.Appointment: { // Create the element that represents // the contents of the dialog var vm = new ScheduleAppointmentViewModel() { Activity = activity, AllowModifications = allowModifications, AllowRemove = allowRemove, Container = container, DataManager = dataManager }; return new ScheduleAppointmentWindow(vm); } default: { // Return null for unsupported activity types. return null; } } }
} The ScheduleAppointmentWindow extends Window.The question is, how can I save/add new appointment by this window? I've tried to: var act = DataManager.CreateNew(ActivityType.Appointment, out dei);and then filling the properties of "act", but I don't view the new activity in the schedule calendar
Hello,
Actually CreateNew method creates new activity but it is not committed to the data source until the EndEdit method is called. You can find more information about the method in its remarks:
http://help.infragistics.com/NetAdvantage/WPF/2011.2/CLR4.0/?page=InfragisticsWPF4.Controls.Schedules.v11.2~Infragistics.Controls.Schedules.XamScheduleDataManager~CreateNew.html
Hope this helps!
Thanks,
Diyan Dimitrov
Thank you for your post. I have been looking into it and I can say that the CreateNew method only creates a new Activity, but doesn’t add it to the XamSchedule, so you have to add it like this for example:
(dataConnector.AppointmentItemsSource as ObservableCollection<Appointment>).Add(act as Appointment);
Where dataConnector is the Name of the ListScheduleDataConector element and you also have to cast the AppointmentItemsSource to the type of your underlying object that you use.
Hope this helps you.