Calendar.SelectedDate プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
現在選択されている日付を取得または設定します。
public:
property Nullable<DateTime> SelectedDate { Nullable<DateTime> get(); void set(Nullable<DateTime> value); };
public DateTime? SelectedDate { get; set; }
member this.SelectedDate : Nullable<DateTime> with get, set
Public Property SelectedDate As Nullable(Of DateTime)
プロパティ値
現在選択されている日付。 既定値は、null です。
例外
SelectionModeがNoneに設定されているときにnull以外の値に設定されている場合。
例
次の例では、表示可能な日付の特定の範囲を持つ Calendar を作成し、現在選択されている日付と表示される日付を設定します。
// 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"/>
注釈
依存関係プロパティ情報
| 品目 | 価値 |
|---|---|
| 識別子フィールド | SelectedDateProperty |
に設定されたメタデータ プロパティ true |
BindsTwoWayByDefault |
このプロパティは、 SelectionMode が SingleDate に設定されている場合に使用します。 その他のモードでは、このプロパティは常に SelectedDates の最初の日付になります。
XAML 属性の使用法
<Calendar SelectedDate="dateTimeString"/>
XAML 値
dateTimeStringDateTime XAML 構文のトピックに記載されているいずれかの形式の日付。