コード例 #1
0
        private void BindViewModel()
        {
            this.bindingContext = new ViewModelContext(this, this.viewModel);

            //this.bindingContext.Bind(label1, this.viewModel, "Text: DecimalToString ( DecimalProperty1, C )");
            //this.bindingContext.Bind(field1, this.viewModel, "Text: Property1");

            this.bindingContext.Bind(label1, "Text", this.viewModel, "Property1");
            this.bindingContext.Bind(label2, "Text", this.viewModel, "Property2");
            this.bindingContext.Bind(field1, "Text", "Ended", this.viewModel, "Property1");
           
            this.bindingContext.Bind(this.button1, "TouchUpInside", "Enabled", this.viewModel.TestCommand);
            this.bindingContext.Bind(this.button2, "TouchUpInside", "Enabled", this.viewModel.TestCommand2);
        }
コード例 #2
0
        private void BindViewModel()
        {
            this.bindingContext = new ViewModelContext(this.Activity, this.viewModel);

            this.bindingContext.Bind(label1, "Text", this.viewModel, "Property1");
            this.bindingContext.Bind(field1, "Text", "TextChanged", this.viewModel, "Property1");

            // TODO: when we have property path bindings working, we can bind to Errors[Property1] for example
            this.bindingContext.Bind(field1, "Error", this.viewModel, "Property1Error");

            this.bindingContext.Bind(this.button1, "Click", "Enabled", this.viewModel.TestCommand);
            this.bindingContext.Bind(this.button2, "Click", "Enabled", this.viewModel.TestCommand2);
        }