Hi Andrew,
I have created my own class “MyClass” and inherited it from Appointment Class.
The Created objects of them and assigned it to the Appointment collection.
After retemplated the igSchedulePrim:ActivityContentPanel, i was able to display my new properties.
So far so good.
But now once I start to add new appointments it gives me following error Stating
The value "Infragistics.Controls.Schedules.Appointment" is not of type "ScheduleSample.MyActivity" and cannot be used in this generic collection.
Parameter name: value
I am I doing anything incorrect?
Regard
Saurabh Dighade
The data connectors don't know to create your derived activity class. You would need to derive from the connector you're using (presumably ListScheduleDataConnector) and override the CreateNew method and create your derived activity type (based upon the ActivityType provided to the method).
OK, I will try that.
But Inheriting from Appointment is the correct thing for adding new properties to appointment?
Is any example available already?
Thanks and Regards
Thansk Andrew, Its Working now.
Please can you let me know if this is the correct way to add new Properties to appointments?
Regards
Saurabh
Inheriting is one way and if you're not using an underlying dataitem then I think it's the only way right now. If you were instead binding the various ItemsSource properties to collections of your own data then I would probably say that using the Metadata property mappings is a better way because then the datamanager knows about those properties and can deal with them should an edit operation be cancelled (to revert all the values to their original state), creating a copy of an activity (i.e. copying the state of these properties as well), etc.
You solution seems more practical, but I have difficulty grasping it completely.
Andrew Says: “you're not using an underlying dataitem”
First you mentioned about dataitem, it a readonly property in ActivityBase class. so how can I assign it my dataitem?
What I need is I have my one Class say scheduleSlot
public class ScheduleSlot
{
Id
Subject
MyProperty
Start
End
//My Custom Properties
myStringActivityName
MyIntegerActivityID
.
MyNumberContract
}
Then I have a class
public class ScheduleData
public ObservableCollection< ScheduleSlot > _appointments = new ObservableCollection< ScheduleSlot >();
public ObservableCollection<Resource> _resources = new ObservableCollection<Resource>();
public ObservableCollection<ResourceCalendar> _resourceCalendars = new ObservableCollection<ResourceCalendar>();
//Code to generate and populate the ScheduleSlot collection with ScheduleSlot activitie objects.
I then give this object of class as DataContext to XamDayView
Since my ScheduleSlot has the exact name of Properties as that required by an appointment, I don’t have to specify AppointmentPropertyMapping
Now If I have to use my “Custom Properties” in say myStringActivityName” or “MyNumberContract ” for display and edit what should I do? I also need to use them in Data binding when I re-template my activity template.
saurabhd13 said: First you mentioned about dataitem, it a readonly property in ActivityBase class. so how can I assign it my dataitem?
saurabhd13 said:Now If I have to use my “Custom Properties” in say myStringActivityName” or “MyNumberContract ” for display and edit what should I do?
saurabhd13 said:I also need to use them in Data binding when I re-template my activity template.
To access the property you would use WPF/SL's support for indexed properties and so in your binding the path would be something like "Metadata[MyNumberContract]"