public static void UpdateBinding(FrameworkElement element, DependencyProperty property, UpdateBindingType updateType)
        {
            BindingExpression bindingExpression = element.GetBindingExpression(property);
            if (bindingExpression != null)
            {
                // If desired, push the current text value to the source of the binding.
                if (updateType == UpdateBindingType.Source || updateType == UpdateBindingType.Both)
                {
                    bindingExpression.UpdateSource();
                }

                // Update the text from the source of the binding.
                if (updateType == UpdateBindingType.Target || updateType == UpdateBindingType.Both)
                {
                    bindingExpression.UpdateTarget();
                }
            }
        }
Beispiel #2
0
        public static void UpdateBinding(FrameworkElement element, DependencyProperty property, UpdateBindingType updateType)
        {
            BindingExpression bindingExpression = element.GetBindingExpression(property);

            if (bindingExpression != null)
            {
                if (updateType == UpdateBindingType.Source || updateType == UpdateBindingType.Both)
                {
                    bindingExpression.UpdateSource();
                }
                if (updateType == UpdateBindingType.Target || updateType == UpdateBindingType.Both)
                {
                    bindingExpression.UpdateTarget();
                }
            }
        }
Beispiel #3
0
        public static void UpdateBinding(FrameworkElement element, DependencyProperty property, UpdateBindingType updateType)
        {
            BindingExpression bindingExpression = element.GetBindingExpression(property);

            if (bindingExpression != null)
            {
                // If desired, push the current text value to the source of the binding.
                if (updateType == UpdateBindingType.Source || updateType == UpdateBindingType.Both)
                {
                    bindingExpression.UpdateSource();
                }

                // Update the text from the source of the binding.
                if (updateType == UpdateBindingType.Target || updateType == UpdateBindingType.Both)
                {
                    bindingExpression.UpdateTarget();
                }
            }
        }