public override void OnApplyTemplate() { base.OnApplyTemplate(); _partTime = Template.FindName("PART_Time", this) as CnDTimeInputTextBox; if (_partTime == null) { throw new Exception("PART_Time is missing"); } _partTime.AddExceptionKey(Key.Add); _partTime.AddExceptionKey(Key.Subtract); _partTime.TimeChanged += OnTimeChanged; var partPreviousDay = Template.FindName("PART_PreviousDay", this) as Button; if (partPreviousDay != null) { partPreviousDay.Click += (s, e) => SelectedDateTime = SelectedDateTime.AddDays(-1); } var partNextDay = Template.FindName("PART_NextDay", this) as Button; if (partNextDay != null) { partNextDay.Click += (s, e) => SelectedDateTime = SelectedDateTime.AddDays(1); } }
public BitDateTimePickerSampleViewModel() { SelectedDateTime = DateTime.Now; ChangeSelecedDate = new Command(() => { SelectedDateTime = SelectedDateTime.AddDays(3); }); }