ondrovic
ondrovic

Reputation: 1175

WPF XAML DatePicker DisplayDateStart

I know you can set the DisplayDateEnd in XAML by doing the following

DisplayDateEnd="{x:Static sys:DateTime.Today}"

Is it possible to set the DisplayDateStart to only go back 6 days including today through XAML

Here is how I am achieving this currently

dpLogDates.DisplayDateStart = DateTime.Today.AddDays(-6);

Upvotes: 0

Views: 3493

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222722

You can create your own static property for this.

 public static class DtHelper
  {
    public static DateTime myTime
    {
      get { return DateTime.Today.AddDays(-6); }
    }
  }

In XAML

DisplayDateEnd="{x:Static app:DtHelper.myTime}"

Upvotes: 3

Related Questions