예제 #1
0
        public ShellViewModel()
        {
            var canExecute = this.WhenAnyValue(vm => vm.EnteredText)
                             .Select(s => !string.IsNullOrWhiteSpace(s));

            Child = new ChildViewModel();

            OKCmd = ReactiveCommand.Create(canExecute);
            OKCmd.Subscribe(_ => Child.Name = "You entered " + EnteredText);
        }
예제 #2
0
        public HomeViewModel()
        {
            //Define conditions
            var okCmdObs = this.WhenAny(vm => vm.EnteredText,
                                        s => !string.IsNullOrWhiteSpace(s.Value));

            //Create conditions
            OKCmd = ReactiveCommand.Create(okCmdObs);

            //Update Status
            OKCmd.Subscribe(_ => Status = EnteredText + " is saved.");
        }