public MainWindow() { InitializeComponent(); var company = new Company { Name = "The Company", Address = "Some Road", Website = "http://thecompany.com", }; DataContext = new MainViewModel(company); }
public MainViewModel(Company company) { _validation = new ValidationAdapter(OnErrorsChanged); _validation.Validators.Add(new DataAnnotationsValidator(GetType())); _company = company; SaveCommand = DelegateCommand .NoParameter() .OnExecute(() => Save()) .OnCanExecute(() => CanSave) .Observe(this, nameof(CanSave)) .Build(); }