Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 3.66 KB

calendarviewdayitem.md

File metadata and controls

42 lines (26 loc) · 3.66 KB
-api-id -api-type
T:Windows.UI.Xaml.Controls.CalendarViewDayItem
winrt class

Windows.UI.Xaml.Controls.CalendarViewDayItem

-description

Represents a day on a CalendarView.

-xaml-syntax

<CalendarViewDayItem .../>

-remarks

The calendar grid of a CalendarView control is composed of CalendarViewDayItem objects. You typically modify the day item in the CalendarViewDayItemChanging event of either a CalendarView or CalendarDatePicker control. Use the Item property of the CalendarViewDayItemChangingEventArgs to access the CalendarViewDayItem object. For more info, see the, "Updating calendar day items ", section of the CalendarView class remarks.

To improve performance, the visual elements of a CalendarViewDayItem are rendered directly by the control, not defined in the control template as XAML elements. This means you can’t style or re-template these elements. However, CalendarView provides several "calendar item" and "day item" properties that you can use to customize these elements, such as CalendarItemBackground, CalendarItemBorderBrush, and DayItemFontSize.

Even though the visual elements of a CalendarViewDayItem are rendered directly by the control, you can use CalendarView.CalendarViewDayItemStyle to set properties like MinWidth, MinHeight, Margin, and Padding. The default Style (see CalendarViewDayItem styles and template) also includes an empty ControlTemplate that you can use to inject custom XAML elements into the CalendarViewDayItem. Your XAML elements are rendered on top of the background elements, and below the day number and labels.

Use the Date property to get the date represented by this day item. The time portions of this property's DateTime value are ignored. If you compare two dates from a CalendarView, be sure to compare only the Date portion of the DateTime value.

Use the IsBlackout property to get or set a value that indicates whether the date is unavailable.

Call the SetDensityColors method to set the collection of Color values used to display the density bar.

Note

The IsBlackout property and the density colors collection are reset each time the day item container is recycled. If you use these features, you should set the values each time the CalendarViewDayItemChanging event occurs.

-examples

-see-also

Control, CalendarView, CalendarView.CalendarViewDayItemChanging, CalendarDatePicker.CalendarViewDayItemChanging