예제 #1
0
        public static T Bind <T>(this T element,
                                 InlineBindingTarget target,
                                 string targetPath,
                                 string sourcePath,
                                 IValueConverter converter = null,
                                 object converterParameter = null,
                                 object fallbackValue      = null,
                                 BindingMode mode          = BindingMode.Default)
        {
            if (string.IsNullOrEmpty(targetPath))
            {
                targetPath = BindingSingletonCache.Instance.DefaultBindingNameLookup.DefaultFor(typeof(T));
            }

            var bindingDescription = new BindingDescription(
                targetPath,
                sourcePath,
                converter,
                converterParameter,
                fallbackValue,
                mode);

            target.BindingContextOwner.AddBinding(element, bindingDescription);

            return(element);
        }
예제 #2
0
 public static T Bind <T, TViewModel>(this T element,
                                      InlineBindingTarget target,
                                      Expression <Func <TViewModel, object> > sourcePropertyPath,
                                      IValueConverter converter,
                                      object converterParameter = null,
                                      object fallbackValue      = null,
                                      BindingMode mode          = BindingMode.Default)
 {
     return(element.Bind(target, null, sourcePropertyPath, converter, converterParameter, fallbackValue, mode));
 }
예제 #3
0
        public static T Bind <T, TViewModel>(this T element,
                                             InlineBindingTarget target,
                                             Expression <Func <T, object> > targetPropertyPath,
                                             Expression <Func <TViewModel, object> > sourcePropertyPath,
                                             string converterName      = null,
                                             object converterParameter = null,
                                             object fallbackValue      = null,
                                             BindingMode mode          = BindingMode.Default)
        {
            var converter = BindingSingletonCache.Instance.ValueConverterLookup.Find(converterName);

            return(element.Bind(target, targetPropertyPath, sourcePropertyPath, converter, converterParameter,
                                fallbackValue, mode));
        }
예제 #4
0
        public static T Bind <T, TViewModel>(this T element,
                                             InlineBindingTarget target,
                                             Expression <Func <T, object> > targetPropertyPath,
                                             Expression <Func <TViewModel, object> > sourcePropertyPath,
                                             IValueConverter converter,
                                             object converterParameter = null,
                                             object fallbackValue      = null,
                                             BindingMode mode          = BindingMode.Default)
        {
            var parser     = BindingSingletonCache.Instance.PropertyExpressionParser;
            var sourcePath = parser.Parse(sourcePropertyPath).Print();
            var targetPath = targetPropertyPath == null ? null : parser.Parse(targetPropertyPath).Print();

            return(element.Bind(target, targetPath, sourcePath, converter, converterParameter, fallbackValue, mode));
        }
예제 #5
0
 public static T Bind <T>(this T element, InlineBindingTarget target,
                          string descriptionText)
 {
     target.BindingContextOwner.AddBindings(element, descriptionText);
     return(element);
 }