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 8151605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:26:25+00:00 2026-06-06T15:26:25+00:00

I have a DatePicker bound to a DataTime within an object, and at run

  • 0

I have a DatePicker bound to a DataTime within an object, and at run time, instead of the string “Select a Date” in DatePicker, “1/1/0001” is shown, making it hard to use the actual calendar. I did not have a problem when I was binding DatePicker with a string, but changing it to a DateTime did this. Please let me know how this works. This is what I have so far:

In XAML I have:

<DatePicker Grid.Column="4" Grid.Row="9" Name="dueDateBox" VerticalAlignment="Center">
    <DatePicker.SelectedDate>
        <Binding Path="DueDate" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
            <Binding.ValidationRules>
                <my:DateRangeRule/>
            </Binding.ValidationRules>
        </Binding>
    </DatePicker.SelectedDate>
</DatePicker>

In the C# I have:

public DateTime DueDate
{
    get { return dueDate; }
    set
    {
        if (DueDate != null) || !DueDate.Equals(value))
        {
            dueDate = value;
            OnPropertyChanged("DueDate");
        }
    }
}

I also have a dependency property set, not sure if this is playing a part:

public static readonly DependencyProperty DueDateProperty =
        DependencyProperty.Register("DueDate", typeof(DateTime),
        typeof(UpdateJobDialog), new PropertyMetadata(DateTime.Now));
  • 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-06T15:26:27+00:00Added an answer on June 6, 2026 at 3:26 pm

    Would probably help to use DateTime? instead of DateTime, since DateTime is not nullable, you are setting to the default value of 1/1/0001, rather than null which would result in the please select a date message you are used to.

    public DateTime? DueDate
    {
        //Need to change the type of the private variable as well
        get { return dueDate; }
        set
        {
            if (DueDate != null) || !DueDate.Equals(value))
            {
                dueDate = value;
                OnPropertyChanged("DueDate");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datepicker on my site. When you select a date, it displays
I have a datepicker which is used within the jQuery dialog object. The source
Possible Duplicate: php/Mysql query with inserting date fails I have a datepicker code below:
I have a jquery datepicker which is renders the current date by default as
I have a datepicker which shows date in format dd/MM/yyyy(i know i coould change
I currently have a combobox with bound to an ObservableCollection <ComboBox ItemsSource={Binding Past} DisplayMemberPath=Date
I have the following code: $(document).ready(function(){ $(.datepicker).each(function() { $(this).datepicker({ beforeShowDay: function(date){ return [$(this).parent().find(span.days).html(), ]
Let's say I have a datePicker called foobar: <g:datePicker name=foobar value=${new Date()} precision=day />
I have: ((DatePicker) findViewById(R.id.my_id)).init(2011, 1, 1, pickerListener); And when I run this, I have
I have two input text boxes which is bound to jquery Datepicker widget. When

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.