Ejemplo n.º 1
0
 public static Binding SetBinding(
     DependencyObject source, DependencyProperty sourceProperty,
     DependencyObject target, DependencyProperty targetProperty,
     BindingMode mode = BindingMode.TwoWay,
     UpdateSourceTrigger sourceTrigger = UpdateSourceTrigger.Default,
     IValueConverter converter         = null,
     object fallbackValue = null)
 {
     return(BindingHelper.SetBinding(
                source, sourceProperty.Name,
                target, targetProperty,
                mode,
                sourceTrigger,
                converter,
                fallbackValue));
 }
Ejemplo n.º 2
0
        public static Binding TryBinding(
            DependencyObject source, DependencyProperty sourceProperty,
            DependencyObject target, string targetPropertyPath,
            BindingMode mode = BindingMode.TwoWay,
            UpdateSourceTrigger sourceTrigger = UpdateSourceTrigger.Default,
            IValueConverter converter         = null,
            object fallbackValue = null)
        {
            var targetProperty = target.FindDependencyProperty(targetPropertyPath);

            if (targetProperty != null)
            {
                return(BindingHelper.SetBinding(
                           source, sourceProperty,
                           target, targetProperty,
                           mode, sourceTrigger, converter, fallbackValue));
            }

            return(null);
        }