Silverlight SDK Date Picker Does Not Reset Selected Date To Date

I have the following definition for DatePicker:

<sdk:DatePicker x:Name="dtpStartDate"
                Grid.Row="4"
                Grid.Column="1"
                SelectedDateFormat="Short"
                SelectedDate="{Binding MyObject.StartDate, Mode=TwoWay, NotifyOnValidationError=True}"/>

MyObjectis a class containing StartDatethat is defined as a null value DateTime.

class MyObjectClass
{
    ....
    public DateTime? StartDate { get; set; }
    ....
}

I am using MVVM (via Prism) and MyObjectproperly connected.

The first time I show this view, the date is empty (as expected), and when I click on the collector, the calendar is displayed with the date highlighted today.

If I select a date (other than today's) or show a record with a filled date, then when I close the form to create a new object:

this.MyObject = new MyObjectClass();

the date highlighted when I click on the collector is the date selected earlier.

, "1 2009 ", . StartDate DateTime.Today, , , , .

, null reset ?

+3
2

reset DisplayDate DatePicker:

        this.SelectedDateChanged += (s, e) =>
        {
            if (this.SelectedDate == null)
            {
                this.DisplayDate = DateTime.Today;
                this.Text = string.Empty;
            }
        };

, DataPicker .

+1

, , , , ViewModel MyObjectClass   INotifyPropertyChanged. , VM MyObject MyObjectClass StartDate PropertyChanged.

0

All Articles