Пример #1
0
        public Checkout()
        {
            InitializeComponent();

            Loaded += (sender, args) => {
                Amount.Focus();
                Amount.SelectAll();
            };
            KeyDown += (sender, args) => {
                if (args.Key == Key.Enter)
                {
                    Model.OK();
                }
            };

            DataContextChanged += (sender, args) => {
                if (Model == null)
                {
                    return;
                }

                Model.IsValid.Subscribe(x => {
                    if (x)
                    {
                        Change.ClearValue(Label.ForegroundProperty);
                    }
                    else
                    {
                        Change.Foreground = Brushes.Red;
                    }
                });
            };
        }