diff options
Diffstat (limited to 'Xamarin.Forms.Core/Interactivity/BindingCondition.cs')
-rw-r--r-- | Xamarin.Forms.Core/Interactivity/BindingCondition.cs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Xamarin.Forms.Core/Interactivity/BindingCondition.cs b/Xamarin.Forms.Core/Interactivity/BindingCondition.cs index 1d111850..ccf55e58 100644 --- a/Xamarin.Forms.Core/Interactivity/BindingCondition.cs +++ b/Xamarin.Forms.Core/Interactivity/BindingCondition.cs @@ -3,6 +3,7 @@ using Xamarin.Forms.Xaml; namespace Xamarin.Forms { + [ProvideCompiled("Xamarin.Forms.Core.XamlC.PassthroughValueProvider")] public sealed class BindingCondition : Condition, IValueProvider { readonly BindableProperty _boundProperty; @@ -41,15 +42,9 @@ namespace Xamarin.Forms } } - internal IServiceProvider ServiceProvider { get; set; } - - internal IValueConverterProvider ValueConverter { get; set; } - object IValueProvider.ProvideValue(IServiceProvider serviceProvider) { - ValueConverter = serviceProvider.GetService(typeof(IValueConverterProvider)) as IValueConverterProvider; - ServiceProvider = serviceProvider; - + //This is no longer required return this; } @@ -71,14 +66,16 @@ namespace Xamarin.Forms bindable.ClearValue(_boundProperty); } + static IValueConverterProvider s_valueConverter = DependencyService.Get<IValueConverterProvider>(); + bool EqualsToValue(object other) { if ((other == Value) || (other != null && other.Equals(Value))) return true; object converted = null; - if (ValueConverter != null) - converted = ValueConverter.Convert(Value, other != null ? other.GetType() : typeof(object), null, ServiceProvider); + if (s_valueConverter != null) + converted = s_valueConverter.Convert(Value, other != null ? other.GetType() : typeof(object), null, null); else return false; |