Export (0) Print
Expand All

DatePicker.SelectedDateFormat Property

Gets or sets the format that is used to display the selected date.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls (in System.Windows.Controls.dll)

public DatePickerFormat SelectedDateFormat { get; set; }
<sdk:DatePicker SelectedDateFormat="Long"/>
-or-
<sdk:DatePicker SelectedDateFormat="Short"/>

Property Value

Type: System.Windows.Controls.DatePickerFormat
The format that is used to display the selected date. The default is Short.

ExceptionCondition
ArgumentOutOfRangeException

The specified format is not valid.

Dependency property identifier field: SelectedDateFormatProperty

The following XAML creates two DatePicker controls, one using the default Short format and the other using the Long format. This example is part of a larger example available in the DatePicker overview.


<!-- Two DatePicker controls, one using the default Short date format -->
<!-- and the other using the Long date format. -->
<StackPanel Orientation="Horizontal" >
<TextBlock Width="200" Margin="5" 
           Text="DatePicker with Short date format and Calendar event handlers:" TextWrapping="Wrap" />
<sdk:DatePicker x:Name="dp1" Height="20" Width="200" />
</StackPanel>
<StackPanel Orientation="Horizontal" >
<TextBlock Width="200" Margin="5"
           Text="DatePicker with Long date format and DateSelected event handler:" TextWrapping="Wrap" />
<sdk:DatePicker Height="20" x:Name="dp2" SelectedDateFormat="Long" Width="200"/>
</StackPanel>


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft