We are looking at the xamSchedule control to implement in our application.
Is there an easy way to have several appointment templates (containing different info) depending on the appointment type.
Does there exists a property like Appointment.ItemTemplate where I can bind a custom datatemplate to.
Hi sidhume,
Which part of the appointment are you trying to template? The presenter part which is shown on the actual day in the calendar? Or the dialog portion which allows you to edit the appointment? It sounds like you want to change the presenter part.
By default we only provide one type of appointment so I'm not sure how you plan to distinguish some appointments as internal and external. Maybe you will derive your own class from Appointment? If you do that, it would be possible to use Style.Triggers in order to control what template to use. You could create your two templates and then in a style for AppointmentPresenter you could add a DataTrigger who's binding is set to the AppointmentPresenter's DataContext. The DataContext will be the appointment. You should add a converter to the binding and inside the converter determine what the appointment type is. If it is internal, you can add a Setter to the DataTrigger that will set the AppointmentPresenter.Template to your internal template. You would need another trigger for the external template as well. Something like this:
<Style TargetType="{x:Type igPrim:AppointmentPresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding Converter={StaticResource CheckAppointmentType}, ConverterParameter={x:Type local:MyInternalAppointment}}" Value="True"> <Setter Property="Template" Value="{StaticResource MyInternalTemplate}"/> </DataTrigger> <DataTrigger Binding="{Binding Converter={StaticResource CheckAppointmentType}, ConverterParameter={x:Type local:MyExternalAppointment}}" Value="True"> <Setter Property="Template" Value="{StaticResource MyExternalTemplate}"/> </DataTrigger> </Style.Triggers> </Style>
Thanks Rob,
The above answer covers what we wanted to do.
We want to create a plannings tool, where each itemtype that can be planned, will be represented by a different appointment type.
Do you think that the xamSchedule control is the right control to use, or do you have a better suggestion (control)?
Kind regards,
Erik
Hi Erik,
When I think of planning tools, a gantt chart usually comes to mind. You can read more about it here. As for whether it is a better fit for your needs, it depends. If all you need is simple scheduling then the xamSchedule would probably be a better fit as you can create the appointments and set the start/end times as desired. Then just feed it to the schedule and it will display it in the proper spot. And since you can derive from the Appointment class you can create different types of them as you require. If you need the ability to setup steps for your planned items then the gantt would be a better fit I think. What I mean by steps is, tasks need to be followed in order so you can't complete task 2 without having completed task 1 first.
Let me know if you have any further questions on this matter.