コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();

            var company = new Company
            {
                Name = "The Company",
                Address = "Some Road",
                Website = "http://thecompany.com",
            };

            DataContext = new MainViewModel(company);
        }
コード例 #2
0
        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();
        }