From b96df000db76ba3490589c37e93224271249bc88 Mon Sep 17 00:00:00 2001 From: Stephane Delcroix Date: Fri, 23 Dec 2016 08:50:19 +0100 Subject: [Xaml] support short Properties for PropertyCondition (#645) --- Xamarin.Forms.Core/BindablePropertyConverter.cs | 2 ++ Xamarin.Forms.Core/IValueConverterProvider.cs | 2 +- Xamarin.Forms.Core/Interactivity/BindingCondition.cs | 6 +++--- Xamarin.Forms.Core/Interactivity/MultiCondition.cs | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'Xamarin.Forms.Core') diff --git a/Xamarin.Forms.Core/BindablePropertyConverter.cs b/Xamarin.Forms.Core/BindablePropertyConverter.cs index a7398e08..08201b01 100644 --- a/Xamarin.Forms.Core/BindablePropertyConverter.cs +++ b/Xamarin.Forms.Core/BindablePropertyConverter.cs @@ -50,6 +50,8 @@ namespace Xamarin.Forms } else if (parentValuesProvider.TargetObject is Trigger) type = (parentValuesProvider.TargetObject as Trigger).TargetType; + else if (parentValuesProvider.TargetObject is PropertyCondition && (parent as TriggerBase) != null) + type = (parent as TriggerBase).TargetType; if (type == null) throw new XamlParseException($"Can't resolve {parts [0]}", lineinfo); diff --git a/Xamarin.Forms.Core/IValueConverterProvider.cs b/Xamarin.Forms.Core/IValueConverterProvider.cs index 1221ce74..b8c684c6 100644 --- a/Xamarin.Forms.Core/IValueConverterProvider.cs +++ b/Xamarin.Forms.Core/IValueConverterProvider.cs @@ -3,7 +3,7 @@ using System.Reflection; namespace Xamarin.Forms.Xaml { - internal interface IValueConverterProvider + interface IValueConverterProvider { object Convert(object value, Type toType, Func minfoRetriever, IServiceProvider serviceProvider); } diff --git a/Xamarin.Forms.Core/Interactivity/BindingCondition.cs b/Xamarin.Forms.Core/Interactivity/BindingCondition.cs index 88b7cf36..1d111850 100644 --- a/Xamarin.Forms.Core/Interactivity/BindingCondition.cs +++ b/Xamarin.Forms.Core/Interactivity/BindingCondition.cs @@ -12,7 +12,7 @@ namespace Xamarin.Forms public BindingCondition() { - _boundProperty = BindableProperty.CreateAttached("Bound", typeof(object), typeof(DataTrigger), null, propertyChanged: OnBoundPropertyChanged); + _boundProperty = BindableProperty.CreateAttached("Bound", typeof(object), typeof(BindingCondition), null, propertyChanged: OnBoundPropertyChanged); } public BindingBase Binding @@ -23,7 +23,7 @@ namespace Xamarin.Forms if (_binding == value) return; if (IsSealed) - throw new InvalidOperationException("Can not change Binding once the Trigger has been applied."); + throw new InvalidOperationException("Can not change Binding once the Condition has been applied."); _binding = value; } } @@ -36,7 +36,7 @@ namespace Xamarin.Forms if (_triggerValue == value) return; if (IsSealed) - throw new InvalidOperationException("Can not change Value once the Trigger has been applied."); + throw new InvalidOperationException("Can not change Value once the Condition has been applied."); _triggerValue = value; } } diff --git a/Xamarin.Forms.Core/Interactivity/MultiCondition.cs b/Xamarin.Forms.Core/Interactivity/MultiCondition.cs index 23ca41c5..1a80190a 100644 --- a/Xamarin.Forms.Core/Interactivity/MultiCondition.cs +++ b/Xamarin.Forms.Core/Interactivity/MultiCondition.cs @@ -8,7 +8,7 @@ namespace Xamarin.Forms public MultiCondition() { - _aggregatedStateProperty = BindableProperty.CreateAttached("AggregatedState", typeof(bool), typeof(DataTrigger), false, propertyChanged: OnAggregatedStatePropertyChanged); + _aggregatedStateProperty = BindableProperty.CreateAttached("AggregatedState", typeof(bool), typeof(MultiCondition), false, propertyChanged: OnAggregatedStatePropertyChanged); Conditions = new TriggerBase.SealedList(); } -- cgit v1.2.3