瀏覽代碼

Fixed Image Issues with MobileButton class
Added bounce animation to MobileCard and MobileButton
Replaced SeparatorColor with BorderColor in MobileTabStrip

Frank van den Bos 1 年之前
父節點
當前提交
2468ef6a2c

+ 5 - 3
InABox.Mobile/InABox.Mobile.Shared/Components/MobileButton/MobileButton.xaml

@@ -20,7 +20,9 @@
                 IsEnabled="True"
                 BackgroundColor="{TemplateBinding BackgroundColor}"
                 BorderColor="{TemplateBinding BorderColor}"
-                Clicked="_frame_OnClicked">
+                Clicked="_frame_OnClicked"
+                IsClippedToBounds="True"
+                HeightRequest="100">
                 <local:MobileCard.Triggers>
                     <DataTrigger TargetType="local:MobileCard" Binding="{TemplateBinding IsEnabled}" Value="False">
                         <Setter Property="BackgroundColor" Value="Silver" />
@@ -47,8 +49,8 @@
                                 x:Name="_image" 
                                 Source="{TemplateBinding Image}"
                                 IsVisible="{TemplateBinding Image, Converter={StaticResource ImageSourceToBooleanConverter}}"
-                                WidthRequest="{TemplateBinding ImageWidth, Converter={StaticResource WidthConverter}}"
-                                HeightRequest="{TemplateBinding ImageHeight, Converter={StaticResource HeightConverter}}"
+                                WidthRequest="{TemplateBinding ImageSize, Converter={StaticResource WidthConverter}}"
+                                HeightRequest="{TemplateBinding ImageSize, Converter={StaticResource HeightConverter}}"
                                 Aspect="AspectFit"
                             />
                             

+ 5 - 3
InABox.Mobile/InABox.Mobile.Shared/Components/MobileButton/MobileButton.xaml.cs

@@ -118,8 +118,8 @@ namespace InABox.Mobile
         
         public Size ImageSize
         {
-            get => (Size)GetValue(ImageProperty);
-            set => SetValue(ImageProperty, value);
+            get => (Size)GetValue(ImageSizeProperty);
+            set => SetValue(ImageSizeProperty, value);
         }
         
         public static readonly BindableProperty TextProperty = BindableProperty.Create(
@@ -201,8 +201,10 @@ namespace InABox.Mobile
             HeightRequest = 40;
         }
         
-        private void _frame_OnClicked(object sender, EventArgs e)
+        private async void _frame_OnClicked(object sender, EventArgs e)
         {
+            Scale = 0.5;
+            await this.ScaleTo(1, 150);
             Clicked?.Invoke(this, new MobileButtonClickEventArgs(Tag));
         }
     }

+ 5 - 1
InABox.Mobile/InABox.Mobile.Shared/Components/MobileCard/MobileCard.cs

@@ -26,10 +26,14 @@ namespace InABox.Mobile
         
         public event EventHandler Clicked;
         
-        protected virtual void OnClick()
+        protected virtual async void OnClick()
         {
             if (IsEnabled)
+            {
+                Scale = 0.5;
+                await this.ScaleTo(1, 150);
                 Clicked?.Invoke(this, EventArgs.Empty);
+            }
         }
         
 

+ 3 - 3
InABox.Mobile/InABox.Mobile.Shared/Components/MobileTabStrip/MobileTabStrip.xaml

@@ -12,8 +12,8 @@
             HasShadow="False" 
             Margin="0" 
 
-            BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}" 
-            BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SeparatorColor'}" 
+            BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='BorderColor'}" 
+            BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}" 
             CornerRadius="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='CornerRadius'}"
             IsClippedToBounds="True">
             <Frame.Padding>
@@ -49,7 +49,7 @@
                             Margin="0" 
                             Padding="0"
                             BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}" 
-                            BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SeparatorColor'}" 
+                            BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}" 
                             CornerRadius="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='CornerRadius'}"
                             IsClippedToBounds="True">
 

+ 18 - 6
InABox.Mobile/InABox.Mobile.Shared/Components/MobileTabStrip/MobileTabStrip.xaml.cs

@@ -64,16 +64,28 @@ namespace InABox.Mobile
             set => SetValue(UnselectedForegroundProperty, value);
         }
         
-        private readonly BindableProperty SeparatorColorProperty = BindableProperty.Create(
-            nameof(SeparatorColor),
+        // private readonly BindableProperty SeparatorColorProperty = BindableProperty.Create(
+        //     nameof(SeparatorColor),
+        //     typeof(Color),
+        //     typeof(MobileTabStrip),
+        //     XF.Material.Forms.Material.Color.Primary);
+        //
+        // public Color SeparatorColor
+        // {
+        //     get => (Color)GetValue(SeparatorColorProperty);
+        //     set => SetValue(SeparatorColorProperty, value);
+        // }
+        
+        private readonly BindableProperty BorderColorProperty = BindableProperty.Create(
+            nameof(BorderColor),
             typeof(Color),
             typeof(MobileTabStrip),
             XF.Material.Forms.Material.Color.Primary);
         
-        public Color SeparatorColor
+        public Color BorderColor
         {
-            get => (Color)GetValue(SeparatorColorProperty);
-            set => SetValue(SeparatorColorProperty, value);
+            get => (Color)GetValue(BorderColorProperty);
+            set => SetValue(BorderColorProperty, value);
         }
         
         private readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(
@@ -92,7 +104,7 @@ namespace InABox.Mobile
             nameof(FontSize),
             typeof(double),
             typeof(MobileTabStrip),
-            Device.GetNamedSize(NamedSize.Medium, typeof(Label)));
+            Device.GetNamedSize(NamedSize.Small, typeof(Label)));
 
         [TypeConverter(typeof(FontSizeConverter))]
         public double FontSize