Date picker no edits and no nulls [Resolved]

Posted by Burledivya under WPF on 1/30/2010 | Views : 4104 | Status : [Member] | Replies : 3
Hi Friends,

Iam new to this forums. by the suggestion of my friend i came to know that this forum is very very good and we get a very good responses. iam new to .NET 3.5 , WPF, infragistics and MVVM.



I have two calender controls and button control ( when clicking the button user see a list of events between the date range. We follow MVVM pattern

1. Start Date(Date Picker) 2. End date(Date Picker) 3. search button

My bussiness gave me some set of rules through which user will be validated.

I have done all validation for the date controls except for the following two:

1. when editing the date picker (manually with out using calender and typing the date) the change event is never recognized in View Model

2. Date picker is not allowing null values ( i need my one my date picker to be empty in page load).

If any body wants i can post my code also..

thanks
Divya




Responses

Posted by: Abhi2434 on: 2/1/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down

Resolved
I dont know about MVVM much, but date type is ValueTypes and so cannot take nulls.

U need

DateTime dt = null // throw error
DateTime dt = default(DateTime); // correct.

So you cant expect to assign DateTime to null.
You may use DateTime? though.

www.abhisheksur.com

Burledivya, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Burledivya on: 2/1/2010 [Member] Starter

Up
0
Down
Hi Abhi thank you very much for your response. My date fields must not throw an error when blank(internally they were assigned the min value but they must be blank.

What you said is correct like DateTime? can you explain more on that. I would really appreciate. Please let me know how to rate your response becoz i did not see any rating control.

Thank you in advance

Burledivya, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Skraghava on: 11/24/2011 [Member] Starter | Points: 25

Up
0
Down
Hi ,

How did you validated the user entered date (not picked one) as if a type "Abc", it is not firing the set property in MVVM. and hence not able to validate.

Please let me know if you any solution on this.

Regards,
Raghavendra SK

Thanks and regards,
Raghavendra SK

Burledivya, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response