Пример #1
0

        
Пример #2
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            if (!string.IsNullOrEmpty(PropertyName))
            {
                StringBuilder bindingBuilder = new StringBuilder($"{PropertyName} {Path}, Mode={Mode}");

                if (!string.IsNullOrEmpty(Converter))
                {
                    bindingBuilder.Append($", Converter={Converter}");
                }

                if (!string.IsNullOrEmpty(ConverterParameter))
                {
                    bindingBuilder.Append($", ConverterParameter={ConverterParameter}");
                }

                if (!string.IsNullOrEmpty(FallbackValue))
                {
                    bindingBuilder.Append($", FallbackValue={FallbackValue}");
                }

                if (!string.IsNullOrEmpty(CommandParameter))
                {
                    bindingBuilder.Append($", CommandParameter={CommandParameter}");
                }

                if (Bindable != null)
                {
                    Bindable.SetValue(Bi.ndProperty, bindingBuilder.ToString());
                }
                else
                {
                    MvxFormsLog.Instance?.Log(LogLevel.Trace, "Can only use MvxBind on a bindable view");
                }
            }
            else if (BindableObjectRaw is IMarkupExtension ext)
            {
                return(ext.ProvideValue(serviceProvider));
            }
            else
            {
                MvxFormsLog.Instance?.Log(LogLevel.Trace, "Can only use MvxBind on a bindable property");
            }

            return(null);
        }