UIDatePicker doesn't change it's Date value, despite the interaction with it

YanKononovYanKononov RUMember
edited April 2016 in Xamarin.iOS

Hello guys!
I've got a problem. I have an UIDatePicker in my cell subview.
What I do is just grab the date from this datepicker.
But the date is what has been initialized when this UIDatepicker was created.
So why it doesn't change it's value even when I interact with it?

                NSDateFormatter df = new NSDateFormatter();
                df.DateStyle = NSDateFormatterStyle.Long;
                df.TimeStyle = NSDateFormatterStyle.Medium;
                df.Locale = NSLocale.CurrentLocale;
                string dateFromString  = df.ToString(dPicker.Date);//here will be not current date on the datepicker, but the old one, that was when the UIDatePicker was instantiated.

BTW, dPicker.ValueChanged event triggers, it means that all should work fine. So I concluded that I'm wrong in my understanding.

I've searched the whole SO(obj-c and swift though), people in there are implementing event handlers or so with AddTarget and other things, but I'm not sure if this is the case?

Any help or clarifying why dPicker.Date value doesn't change over time will be appreciated.
Thanks.

Sign In or Register to comment.