Exemplo n.º 1
0
    private void BindTextPropertyToTargetPropertyNameOnce()
    {
        if (_firstRun)
        {
            _firstRun = false;
            var binding = new Binding(TargetPropertyName)
            {
                Mode = BindingMode.TwoWay,
                UpdateSourceTrigger     = UpdateSourceTrigger.PropertyChanged,
                ValidatesOnDataErrors   = true,
                NotifyOnValidationError = true
            };

            MainTextBox.SetBinding(TextBox.TextProperty, binding);
        }
    }