Search
Item Presenters

The item presenters are objects of the ItemPresenter class (or a class derived from ItemPresenter) which are used to define the visual presentation of items in the Calendar control. Using a separate object for presentation provides abstraction between the data (Item) and the displaying control (Calendar). This abstraction brings several notable benefits.

  • The appearance of the items in a Calendar control can be customized without modifying the Item class. To do this a new style with a setter for the control's Template has to be defined for the ItemPresenter class.
  • The same schedule can be displayed in several Calendar controls simultaneously.
  • Different presenters can be used for the same items in different Calendar controls, or for different items in the same Calendar control.

The ItemPresenter objects are instantiated by the Calendar control when an item needs to be displayed. A special event is raised every time a presenter is created - ItemPresenterCreated. It is possible that several presenters are created for a single item. For example, consider the case when an item wraps across several rows in a SingleMonth or WeekRange views.

The ItemPresenter class provides several properties, which can be bound to from within the control template. Orientation and StyleKeyStyleKeyComplex, StyleKeySimpleHorizontal and StyleKeySimpleVertical are probably the most important properties as they define the control template that should be used for the presenter.

The complete XAML code of the default item template can be found herehereCreating New Item TemplateCreating New Item TemplateCreating New Item Presenter.