Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
415
XamDateTimeEditor default date?
posted

I have two date pickers for users to select a from-to range.

I want the default 'from' date to be today -30 days, and the 'to' date to be today (hour included).

How do I do this? 

Parents
No Data
Reply
  • 54937
    Suggested Answer
    Offline posted

    There is no "default" date per se. The control shows the date associated with its current value so you need to set the Value in xaml or in code to a given date. In code would probably be the easiest thing - e.g. this.startDate.Value = DateTime.Today.AddDays(-30);. In you need to do this in xaml you could probably write your own custom MarkupExtension that returns a date given some offset or do a onetime binding to a static property that you expose.

Children
No Data