ComponentOne Scheduler for WPF: Using Scheduler for WPF > Scheduler for WPF Appearance > Showing Multiple Day Appointments

Showing Multiple Day Appointments

The AppointmentsCoverPane control visually represents a set of appointments that fit in a time range exposed by a current view, and to draw appointment boxes relative to user interface (UI) elements representing VisualIntervals covered by the appointment. This control, when placed somewhere inside a C1Scheduler visual tree, usually in the C1Scheduler's ControlTemplate, provides a surface where appointment boxes are drawn relative to the UI for VisualIntervals. The AppointmentsCoverPane control is able to recognize the case when an appointment box must be divided into two or more visual boxes. For example, in Month view, if an appointment covers three days, AppointmentsCoverPane will automatically draw three boxes in each corresponding day of the appointment.

The content of an AppointmentsCoverPane appointment box is represented by the DataTemplate defined in the IntervalAppointmentTemplate property.

The AppointmentsCoverPane control provides functionality for an arbitrary UI representing VisualIntervals. To make this possible, each element that can be treated as a VisualInterval UI representative, usually an outer (root) element in the VisualIntervalTemplate definition, and must have the attached OrientationProperty field assigned. Note that CoverElementsPane is the base class for the AppointmentsCoverPane class. The assigned value indicates a chronological flow direction of interval elements and can take Horizontal or Vertical values. For example, interval elements in the Working Week View will have it assigned to Vertical, while elements of Month View assign it to Horizontal.

The C1Scheduler visual tree can contain several AppointmentsCoverPanes. For example, the default DayView template contains one AppointmentsCoverPane to display all-day events in day headers and the second AppointmentsCoverPane to display short appointments over the time slots. To filter appointments which should be displayed by the AppointmentsCoverPane, assign the AppointmentsCoverPane.Appointmentfilter attached property and the CoverElementsPane.PaneName attached property to the VisualIntervalTemplate definition. The AppointmentsCoverPane.Appointmentfilter attached property can be set to AppointmentFilterEnum.Event (show only all-day and multiple-day appointments), AppointmentFilterEnum.Appointment (show only appointments with a duration of 24 hours or less) and AppointmentFilterEnum.All values. The CoverElementsPane.PaneName property should be set to the name of the AppointmentsCoverPane object that should display an appointment. For example:

  <Setter Property="local:C1Scheduler.VisualIntervalTemplate">

    <Setter.Value>     

      <DataTemplate>

        <Border x:Name="IntervalBorder" SnapsToDevicePixels="True"

              Background="{Binding Path=Scheduler.Theme.WorkHourBrush}"

                    BorderBrush="{Binding Path=Scheduler.Theme.WorkHourLightBorderBrush}"

                    BorderThickness="0,1px,0,0"

                    local:AppointmentsCoverPane.AppointmentFilter="Appointment"

                    local:CoverElementsPane.Orientation="Vertical"

                    local:CoverElementsPane.PaneName="appPane"

                    MinHeight="20">

          <Border.InputBindings>

            <MouseBinding MouseAction="LeftDoubleClick"

                Command="local:C1Scheduler.NewAppointmentDialogCommand"/>

          </Border.InputBindings>

        </Border>

        <DataTemplate.Triggers>

          <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">

            <Setter TargetName="IntervalBorder" Property="Background"

                    Value="{Binding Path=Scheduler.Theme.SelectedSlotBrush}" />

          </DataTrigger>

        </DataTemplate.Triggers>

      </DataTemplate>

    </Setter.Value>

  </Setter>


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.