Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
600
Custom appointment temlates
posted

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.

  • internal appointment: subject, room, icon for presence of beamer, ...
  • external appointment: subject, full address

Does there exists a property like Appointment.ItemTemplate where I can bind a custom datatemplate to.

 

 

Parents
  • 34510
    Verified Answer
    Offline posted

    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>

     

Reply Children