ערוך

שתף באמצעות


Calendar.DisplayDateStart Property

Definition

Gets or sets the first date that is available in the calendar.

public:
 property Nullable<DateTime> DisplayDateStart { Nullable<DateTime> get(); void set(Nullable<DateTime> value); };
public DateTime? DisplayDateStart { get; set; }
member this.DisplayDateStart : Nullable<DateTime> with get, set
Public Property DisplayDateStart As Nullable(Of DateTime)

Property Value

The first date that is available in the calendar. The default is null.

Examples

The following code sets up a Calendar with a particular range of displayable dates, and sets the currently selected and displayed date.

// Create a Calendar that displays 1/10/2009
// through 4/18/2009.
Calendar basicCalendar = new Calendar();
basicCalendar.DisplayDateStart = new DateTime(2009, 1, 10);
basicCalendar.DisplayDateEnd = new DateTime(2009, 4, 18);
basicCalendar.DisplayDate = new DateTime(2009, 3, 15);
basicCalendar.SelectedDate = new DateTime(2009, 2, 15);

// root is a Panel that is defined elswhere.
root.Children.Add(basicCalendar);
' Create a Calendar that displays 1/10/2009 
' through 4/18/2009. 
Dim basicCalendar As New Calendar()
basicCalendar.DisplayDateStart = New DateTime(2009, 1, 10)
basicCalendar.DisplayDateEnd = New DateTime(2009, 4, 18)
basicCalendar.DisplayDate = New DateTime(2009, 3, 15)
basicCalendar.SelectedDate = New DateTime(2009, 2, 15)

' root is a Panel that is defined elswhere. 
root.Children.Add(basicCalendar)
<!-- Create a Calendar that displays 1/10/2009
           through 4/18/2009. -->
<Calendar Margin="20" 
          SelectedDate="2/15/2009"
          DisplayDate="3/15/2009"
          DisplayDateStart="1/10/2009"
          DisplayDateEnd="4/18/2009"/>

Remarks

You can restrict the range of a Calendar by setting the DisplayDateStart and DisplayDateEnd properties. A user cannot scroll to or select dates outside of this range. If you set the SelectedDate property to a date that is before DisplayDateStart, DisplayDateStart is set to the same value as SelectedDate.

Dependency Property Information

Identifier field DisplayDateStartProperty
Metadata properties set to true BindsTwoWayByDefault

XAML Attribute Usage

<Calendar DisplayDateStart="dateTimeString"/>  

XAML Values

dateTimeString
A date that is in one of the formats that are listed in the DateTime XAML Syntax topic.

Applies to

See also