Esempio n. 1
0
        private void InitializeDataboundControls()
        {
            var realTimeInput  = new TextBox();
            var realTimeOutput = new TextBox();

            _twoWayUpdate  = new TextBox();
            _sampleDatabag = new SampleDatabag();

            _sampleDatabag.PropertyChanged += _sampleDatabag_PropertyChanged;

            realTimeInput.TextChanged += realTimeInput_TextChanged;

            var binding = new Binding
            {
                Path   = new PropertyPath("Value"),
                Source = _sampleDatabag,
                Mode   = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            };

            realTimeOutput.SetBinding(TextBox.TextProperty, binding);

            this.AddAutoHeightRow();
            this.AddChild(realTimeInput, this.LastRowIndex(), 0);
            this.AddChild(realTimeOutput, this.LastRowIndex(), 1);
            this.AddChild(_twoWayUpdate, this.LastRowIndex(), 2);
        }
        private void InitializeDataboundControls()
        {
            var realTimeInput = new TextBox();
            var realTimeOutput = new TextBox();

            _twoWayUpdate = new TextBox();
            _sampleDatabag = new SampleDatabag();

            _sampleDatabag.PropertyChanged += _sampleDatabag_PropertyChanged;

            realTimeInput.TextChanged += realTimeInput_TextChanged;

            var binding = new Binding
            {
                Path = new PropertyPath("Value"),
                Source = _sampleDatabag,
                Mode = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            };

            realTimeOutput.SetBinding(TextBox.TextProperty, binding);

            this.AddAutoHeightRow();
            this.AddChild(realTimeInput, this.LastRowIndex(), 0);
            this.AddChild(realTimeOutput, this.LastRowIndex(), 1);
            this.AddChild(_twoWayUpdate, this.LastRowIndex(), 2);
        }