Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows;
- using System.Windows.Input;
- using MvvmFoundation.Wpf;
- namespace MVVM_Test.ViewModel
- {
- public class ViewModel : ObservableObject
- {
- private DateTime selectedDate;
- public DateTime SelectedDate
- {
- get
- {
- return selectedDate;
- }
- set
- {
- selectedDate = value;
- RaisePropertyChanged("SelectedDate");
- }
- }
- public ViewModel()
- {
- SelectedDate = DateTime.Now;
- }
- public ICommand PrevHistory_cmd
- {
- get { return new RelayCommand(PrevHistoryExecute, PrevHistoryCanExecute); }
- }
- private void PrevHistoryExecute()
- {
- SelectedDate = SelectedDate - new TimeSpan(1, 0, 0, 0);
- }
- private bool PrevHistoryCanExecute()
- {
- return true;
- }
- public ICommand NextHistory_cmd
- {
- get { return new RelayCommand(NextHistoryExecute, NextHistoryCanExecute); }
- }
- private void NextHistoryExecute()
- {
- SelectedDate = SelectedDate + new TimeSpan(1, 0, 0, 0);
- }
- private bool NextHistoryCanExecute()
- {
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement