Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8545747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:51:49+00:00 2026-06-11T12:51:49+00:00

I have the following definition for a DatePicker : <sdk:DatePicker x:Name=dtpStartDate Grid.Row=4 Grid.Column=1 SelectedDateFormat=Short

  • 0

I have the following definition for a DatePicker:

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

MyObject is a class that contains the StartDate which is defined as a nullable DateTime.

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

I’m using MVVM (via Prism) and MyObject is correctly bound.

The first time I display this view the date is blank (as expected) and when I click on the picker the calendar is displayed with today’s date highlighted.

If I select a date (other than today) or display a record with a date filled then when I blank the form to create a new object:

this.MyObject = new MyObjectClass();

the date hightlighted when I click on the picker is the previously selected date.

So if the record showed “1st May 2009” that’s what would be highlighted in the picker. I can set StartDate to DateTime.Today which is correctly displayed, but does mean that a date is displayed in the form which I don’t want.

So, why doesn’t setting the date to null reset the selected date in the picker to today?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:51:50+00:00Added an answer on June 11, 2026 at 12:51 pm

    The solution is to reset the DisplayDate property on the DatePicker:

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

    To add this functionality we had to subclass the DataPicker though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following definition of a LibraryStack: <s:LibraryStack Name=TaggingContainer Margin=20 Grid.Row=1 Grid.ColumnSpan=2 AllowDrop=True
I have following definition in Employee class @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "employee_id")
I have the following definition: @Column(name = password, length = 80) byte[] password; When
I have following definition in ivy.xml <dependency org=southbeach name=ego rev=4.3.1 conf=properties->asterik > <artifact name=ego
I have the following record definition: -record(contact, {name, email}) Assuming that I have a
I have defined two dimensional array using following definition typedef std::vector<std::vector<short> > table_t; Can
I have the following field definition in my SOlr Schema name=DvdReleaseDate type=date stored=true required=false
Suppose have following beach definition: <bean id=singletonBean class=...> <property name=instanceBean ref=instanceBean/> </bean> <bean id=instanceBean
I have the following definition... <bean id=fsi class=org.springframework.security.intercept.web.FilterSecurityInterceptor> <property name=authenticationManager ref=authenticationManager/> <property name=accessDecisionManager ref=httpRequestAccessDecisionManager/>
I have following bean definition for my DAO - <bean id=userDao class=UserDao> <property name=dataSource

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.