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