コード例 #1
0
        public static void BindLanguage(this IMvxBindingContextOwner owner
                                        , object target
                                        , string targetPropertyName
                                        , string sourceKey
                                        , string sourcePropertyName = null
                                        , string fallbackValue      = null
                                        , string converterName      = null)
        {
            converterName      = converterName ?? LanguageParser.DefaultConverterName;
            sourcePropertyName = sourcePropertyName ?? LanguageParser.DefaultTextSourceName;

            var converter = ValueConverterLookup.Find(converterName);

            var bindingDescription = new MvxBindingDescription
            {
                TargetName         = targetPropertyName,
                SourcePropertyPath = sourcePropertyName,
                Converter          = converter,
                ConverterParameter = sourceKey,
                FallbackValue      = fallbackValue,
                Mode = MvxBindingMode.OneWay
            };

            owner.AddBinding(target, bindingDescription);
        }
コード例 #2
0
        public static void Bind <TTarget, TSource>(this TTarget bindingOwner,
                                                   Expression <Func <TSource, object> > sourcePropertyPath,
                                                   string converterName,
                                                   object converterParameter = null,
                                                   object fallbackValue      = null,
                                                   MvxBindingMode mode       = MvxBindingMode.Default)
            where TTarget : class, IMvxBindingContextOwner
        {
            var converter = ValueConverterLookup.Find(converterName);

            bindingOwner.Bind(bindingOwner, string.Empty, sourcePropertyPath, converter, converterParameter,
                              fallbackValue, mode);
        }