DatePicker.CalendarStyle 屬性

定義

取得或設定當呈現日曆時所使用的樣式。

public:
 property System::Windows::Style ^ CalendarStyle { System::Windows::Style ^ get(); void set(System::Windows::Style ^ value); };
public System.Windows.Style CalendarStyle { get; set; }
member this.CalendarStyle : System.Windows.Style with get, set
Public Property CalendarStyle As Style

屬性值

Style

當呈現日曆時所使用的樣式。

範例

下列範例會 Style 建立 的 Calendar ,並將樣式指派給 CalendarStyle 屬性。

<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>

備註

CalendarStyle使用 屬性來指定下拉式行事曆的外觀。

相依性屬性資訊

識別碼欄位 CalendarStyleProperty
設定為 的中繼資料屬性 true

XAML Attribute Usage

<DatePicker CalendarStyle="{resourceExtension styleResourceKey}"/>  

XAML 值

resourceExtension
下列其中一項: StaticResourceDynamicResource 。 如需詳細資訊,請參閱 XAML 資源

styleResourceKey
識別所要求範本的索引鍵。 索引鍵是指 中的 ResourceDictionary 現有資源。

適用於