diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml index 64ff39628..2cc30f1d8 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:light="clr-namespace:Xamarin.Forms.Themes;assembly=Xamarin.Forms.Theme.Light" xmlns:converters="clr-namespace:eShopOnContainers.Core.Converters;assembly=eShopOnContainers.Core" - xmlns:effects="clr-namespace:eShopOnContainers.Core.Effects;assembly=eShopOnContainers.Core" + xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core" x:Class="eShopOnContainers.App"> @@ -135,9 +135,9 @@ Value="Bold" /> - - - - - diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Effects/LineColorEffect.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Behaviors/LineColorBehavior.cs similarity index 62% rename from src/Mobile/eShopOnContainers/eShopOnContainers.Core/Effects/LineColorEffect.cs rename to src/Mobile/eShopOnContainers/eShopOnContainers.Core/Behaviors/LineColorBehavior.cs index 2635b3a3f..8ae766e14 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Effects/LineColorEffect.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Behaviors/LineColorBehavior.cs @@ -1,14 +1,18 @@ using System.Linq; using Xamarin.Forms; +using eShopOnContainers.Core.Effects; -namespace eShopOnContainers.Core.Effects +namespace eShopOnContainers.Core.Behaviors { - public static class LineColorEffect + public static class LineColorBehavior { public static readonly BindableProperty ApplyLineColorProperty = - BindableProperty.CreateAttached("ApplyLineColor", typeof(bool), typeof(LineColorEffect), false, + BindableProperty.CreateAttached("ApplyLineColor", typeof(bool), typeof(LineColorBehavior), false, propertyChanged: OnApplyLineColorChanged); + public static readonly BindableProperty LineColorProperty = + BindableProperty.CreateAttached("LineColor", typeof(Color), typeof(LineColorBehavior), Color.Default); + public static bool GetApplyLineColor(BindableObject view) { return (bool)view.GetValue(ApplyLineColorProperty); @@ -19,6 +23,16 @@ namespace eShopOnContainers.Core.Effects view.SetValue(ApplyLineColorProperty, value); } + public static Color GetLineColor(BindableObject view) + { + return (Color)view.GetValue(LineColorProperty); + } + + public static void SetLineColor(BindableObject view, Color value) + { + view.SetValue(LineColorProperty, value); + } + private static void OnApplyLineColorChanged(BindableObject bindable, object oldValue, object newValue) { var view = bindable as View; @@ -43,25 +57,5 @@ namespace eShopOnContainers.Core.Effects } } } - - public static readonly BindableProperty LineColorProperty = - BindableProperty.CreateAttached("LineColor", typeof(Color), typeof(LineColorEffect), Color.Default); - - public static Color GetLineColor(BindableObject view) - { - return (Color)view.GetValue(LineColorProperty); - } - - public static void SetLineColor(BindableObject view, Color value) - { - view.SetValue(LineColorProperty, value); - } - - class EntryLineColorEffect : RoutingEffect - { - public EntryLineColorEffect() : base("eShopOnContainers.EntryLineColorEffect") - { - } - } } } \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Effects/EntryLineColorEffect.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Effects/EntryLineColorEffect.cs new file mode 100644 index 000000000..a58129775 --- /dev/null +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Effects/EntryLineColorEffect.cs @@ -0,0 +1,11 @@ +using Xamarin.Forms; + +namespace eShopOnContainers.Core.Effects +{ + public class EntryLineColorEffect : RoutingEffect + { + public EntryLineColorEffect() : base("eShopOnContainers.EntryLineColorEffect") + { + } + } +} diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml index ea28674ab..559197efd 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml @@ -6,7 +6,6 @@ xmlns:animations="clr-namespace:eShopOnContainers.Core.Animations;assembly=eShopOnContainers.Core" xmlns:triggers="clr-namespace:eShopOnContainers.Core.Triggers;assembly=eShopOnContainers.Core" xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core" - xmlns:effects="clr-namespace:eShopOnContainers.Core.Effects;assembly=eShopOnContainers.Core" viewModelBase:ViewModelLocator.AutoWireViewModel="true"> - + @@ -225,7 +224,7 @@ TargetType="Entry" Binding="{Binding Password.IsValid}" Value="False"> - + diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj index 31e26ad1a..c3211d837 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj @@ -58,7 +58,6 @@ - @@ -165,6 +164,8 @@ + + diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/Effects/EntryLineColorEffect.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/Effects/EntryLineColorEffect.cs index fc889765e..6cca1d23d 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/Effects/EntryLineColorEffect.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/Effects/EntryLineColorEffect.cs @@ -3,7 +3,7 @@ using eShopOnContainers.Droid.Effects; using Xamarin.Forms.Platform.Android; using System; using Android.Widget; -using eShopOnContainers.Core.Effects; +using eShopOnContainers.Core.Behaviors; using System.ComponentModel; using System.Diagnostics; @@ -34,7 +34,7 @@ namespace eShopOnContainers.Droid.Effects protected override void OnElementPropertyChanged(PropertyChangedEventArgs args) { - if (args.PropertyName == LineColorEffect.LineColorProperty.PropertyName) + if (args.PropertyName == LineColorBehavior.LineColorProperty.PropertyName) { UpdateLineColor(); } @@ -46,7 +46,7 @@ namespace eShopOnContainers.Droid.Effects { if (control != null) { - control.Background.SetColorFilter(LineColorEffect.GetLineColor(Element).ToAndroid(), Android.Graphics.PorterDuff.Mode.SrcAtop); + control.Background.SetColorFilter(LineColorBehavior.GetLineColor(Element).ToAndroid(), Android.Graphics.PorterDuff.Mode.SrcAtop); } } catch (Exception ex) diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/Effects/EntryLineColorEffect.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/Effects/EntryLineColorEffect.cs index a35eb4970..5dfbce19e 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/Effects/EntryLineColorEffect.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/Effects/EntryLineColorEffect.cs @@ -8,7 +8,7 @@ using Xamarin.Forms; using Xamarin.Forms.Platform.UWP; using Windows.UI.Xaml.Controls; using eShopOnContainers.Windows.Effects; -using eShopOnContainers.Core.Effects; +using eShopOnContainers.Core.Behaviors; [assembly: ResolutionGroupName("eShopOnContainers")] [assembly: ExportEffect(typeof(EntryLineColorEffect), "EntryLineColorEffect")] @@ -38,7 +38,7 @@ namespace eShopOnContainers.Windows.Effects protected override void OnElementPropertyChanged(PropertyChangedEventArgs args) { - if (args.PropertyName == LineColorEffect.LineColorProperty.PropertyName) + if (args.PropertyName == LineColorBehavior.LineColorProperty.PropertyName) { UpdateLineColor(); } @@ -49,7 +49,7 @@ namespace eShopOnContainers.Windows.Effects if (control != null) { control.BorderThickness = new Xaml.Thickness(0, 0, 0, 1); - var lineColor = XamarinFormColorToWindowsColor(LineColorEffect.GetLineColor(Element)); + var lineColor = XamarinFormColorToWindowsColor(LineColorBehavior.GetLineColor(Element)); control.BorderBrush = new Media.SolidColorBrush(lineColor); var style = Xaml.Application.Current.Resources["FormTextBoxStyle"] as Xaml.Style; diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/Effects/EntryLineColorEffect.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/Effects/EntryLineColorEffect.cs index 2e370e1ed..2db59df50 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/Effects/EntryLineColorEffect.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/Effects/EntryLineColorEffect.cs @@ -1,6 +1,6 @@ using CoreAnimation; using CoreGraphics; -using eShopOnContainers.Core.Effects; +using eShopOnContainers.Core.Behaviors; using eShopOnContainers.iOS.Effects; using System; using System.ComponentModel; @@ -39,7 +39,7 @@ namespace eShopOnContainers.iOS.Effects { base.OnElementPropertyChanged(args); - if (args.PropertyName == LineColorEffect.LineColorProperty.PropertyName || + if (args.PropertyName == LineColorBehavior.LineColorProperty.PropertyName || args.PropertyName == "Height") { Initialize(); @@ -71,7 +71,7 @@ namespace eShopOnContainers.iOS.Effects } lineLayer.Frame = new CGRect(0f, Control.Frame.Height - 1f, Control.Bounds.Width, 1f); - lineLayer.BorderColor = LineColorEffect.GetLineColor(Element).ToCGColor(); + lineLayer.BorderColor = LineColorBehavior.GetLineColor(Element).ToCGColor(); control.TintColor = control.TextColor; }