Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CalendarStyle Property

DatePicker.CalendarStyle Property

Gets or sets the style that is used when rendering the calendar.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public Style CalendarStyle { get; set; }
<object>
  <object.CalendarStyle>
    <Style .../>
  </object.CalendarStyle>
</object>
<DatePicker CalendarStyle="{resourceExtension styleResourceKey}"/>

XAML Values

resourceExtension

One of the following: StaticResource or DynamicResource. For more information, see XAML Resources.

styleResourceKey

The key that identifies the template being requested. The key refers to an existing resource in a ResourceDictionary.

Property Value

Type: System.Windows.Style
The style that is used when rendering the calendar.

Identifier field

CalendarStyleProperty

Metadata properties set to true

None

Use the CalendarStyle property to specify the appearance of the drop-down calendar.

The following example creates a Style for Calendar and assigns the style to the CalendarStyle property.

<StackPanel>
  <StackPanel.Resources>
    <Style TargetType="Calendar"
           x:Key="DateTimeCalendar">
      <Setter Property="Background" Value="LightBlue"/>
      <Setter Property="BorderBrush" Value="DarkBlue"/>
      <Setter Property="BorderThickness" Value="5"/>
    </Style>

  </StackPanel.Resources>
  <DatePicker Background="DarkBlue"
              CalendarStyle="{StaticResource DateTimeCalendar}"/>
</StackPanel>

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4
Show:
© 2015 Microsoft