Skip to content

Commit a158233

Browse files
author
Javier Suárez Ruiz
committed
Adapt UI to UWP App
1 parent 490a16c commit a158233

19 files changed

Lines changed: 345 additions & 39 deletions

src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,39 @@
136136
</Style.Triggers>
137137
</Style>
138138

139+
<Style x:Key="UwpEntryStyle"
140+
TargetType="{x:Type Entry}">
141+
<Setter Property="FontFamily"
142+
Value="{StaticResource MontserratRegular}" />
143+
<Setter Property="TextColor"
144+
Value="{StaticResource BlackColor}" />
145+
<Setter Property="PlaceholderColor"
146+
Value="{StaticResource BlackColor}" />
147+
<Setter Property="FontSize"
148+
Value="{StaticResource LargeSize}" />
149+
<Setter Property="HorizontalOptions"
150+
Value="FillAndExpand" />
151+
<Setter Property="FontAttributes"
152+
Value="Bold" />
153+
<Setter Property="BackgroundColor"
154+
Value="Transparent" />
155+
<Setter Property="Opacity"
156+
Value="0.6" />
157+
<Setter Property="effects:LineColorEffect.ApplyLineColor"
158+
Value="True" />
159+
<Setter Property="effects:LineColorEffect.LineColor"
160+
Value="Gray" />
161+
<Style.Triggers>
162+
<Trigger TargetType="Entry"
163+
Property="IsFocused"
164+
Value="True">
165+
<Setter Property="Opacity" Value="1" />
166+
<Setter Property="effects:LineColorEffect.LineColor"
167+
Value="{StaticResource GreenColor}" />
168+
</Trigger>
169+
</Style.Triggers>
170+
</Style>
171+
139172
<Style TargetType="NavigationPage">
140173
<Setter Property="BarBackgroundColor" Value="{StaticResource GreenColor}"/>
141174
<Setter Property="BarTextColor" Value="{StaticResource WhiteColor}"/>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ContentView
3+
xmlns="http://xamarin.com/schemas/2014/forms"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5+
x:Class="eShopOnContainers.Core.Controls.CartButton">
6+
<ContentView.Resources>
7+
<ResourceDictionary>
8+
9+
<Style x:Key="AddButtonStyle"
10+
TargetType="{x:Type Grid}">
11+
<Setter Property="HeightRequest"
12+
Value="42" />
13+
<Setter Property="WidthRequest"
14+
Value="42" />
15+
<Setter Property="HorizontalOptions"
16+
Value="Center" />
17+
<Setter Property="VerticalOptions"
18+
Value="End" />
19+
<Setter Property="Margin"
20+
Value="0, 0, 0, 24" />
21+
</Style>
22+
23+
<Style x:Key="AddBackgroundImageStyle"
24+
TargetType="{x:Type Image}">
25+
<Setter Property="HorizontalOptions"
26+
Value="Center" />
27+
<Setter Property="VerticalOptions"
28+
Value="Center" />
29+
<Setter Property="HeightRequest"
30+
Value="128" />
31+
<Setter Property="WidthRequest"
32+
Value="128" />
33+
</Style>
34+
35+
<Style x:Key="AddImageStyle"
36+
TargetType="{x:Type Image}">
37+
<Setter Property="HeightRequest"
38+
Value="24" />
39+
<Setter Property="WidthRequest"
40+
Value="24" />
41+
</Style>
42+
43+
</ResourceDictionary>
44+
</ContentView.Resources>
45+
<ContentView.Content>
46+
<Grid>
47+
<!-- IOS & ANDROID -->
48+
<Grid
49+
Style="{StaticResource AddButtonStyle}">
50+
<Grid.IsVisible>
51+
<OnPlatform
52+
x:TypeArguments="x:Boolean"
53+
Android="True"
54+
iOS="True"
55+
WinPhone="False"/>
56+
</Grid.IsVisible>
57+
<BoxView
58+
BackgroundColor="{StaticResource LightGreenColor}"
59+
StyleClass="Circle" />
60+
<Image
61+
Aspect="AspectFit"
62+
Source="product_add"
63+
Style="{StaticResource AddImageStyle}">
64+
<Image.Margin>
65+
<OnPlatform
66+
x:TypeArguments="Thickness"
67+
Android="5, 12, 12, 12"
68+
iOS="6, 12, 12, 12"/>
69+
</Image.Margin>
70+
</Image>
71+
</Grid>
72+
<!-- UWP -->
73+
<Grid>
74+
<Image
75+
Source="Assets/circle_button_background.png"
76+
Aspect="AspectFit"
77+
Style="{StaticResource AddBackgroundImageStyle}" />
78+
<Image
79+
Aspect="AspectFit"
80+
Source="Assets\product_add.png"
81+
Style="{StaticResource AddImageStyle}"
82+
Margin="12" />
83+
</Grid>
84+
</Grid>
85+
</ContentView.Content>
86+
</ContentView>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Xamarin.Forms;
2+
3+
namespace eShopOnContainers.Core.Controls
4+
{
5+
public partial class CartButton : ContentView
6+
{
7+
public CartButton()
8+
{
9+
InitializeComponent();
10+
}
11+
}
12+
}

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Effects/LineColorEffect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void SetLineColor(BindableObject view, Color value)
5959

6060
class EntryLineColorEffect : RoutingEffect
6161
{
62-
public EntryLineColorEffect() : base("BikeSharing.EntryLineColorEffect")
62+
public EntryLineColorEffect() : base("eShopOnContainers.EntryLineColorEffect")
6363
{
6464
}
6565
}

src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/MainViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public class MainViewModel : ViewModelBase
1010
{
1111
public override Task InitializeAsync(object navigationData)
1212
{
13+
IsBusy = true;
14+
1315
if (navigationData is TabParameter)
1416
{
1517
var tabIndex = ((TabParameter)navigationData).TabIndex;

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/CustomNavigationPage.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
<NavigationPage xmlns="http://xamarin.com/schemas/2014/forms"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
x:Class="eShopOnContainers.Core.Views.CustomNavigationPage"
5+
BarBackgroundColor="{StaticResource GreenColor}"
6+
BarTextColor="{StaticResource WhiteColor}"
57
BackgroundColor="Transparent">
68
</NavigationPage>

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/FiltersView.xaml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,39 @@
6262
RowSpacing="0"
6363
Margin="48, 24">
6464
<Grid.RowDefinitions>
65-
<RowDefinition />
66-
<RowDefinition />
65+
<RowDefinition Height="60" />
66+
<RowDefinition Height="60" />
6767
<RowDefinition Height="Auto" />
6868
<RowDefinition Height="Auto" />
6969
</Grid.RowDefinitions>
70-
<controls:BindablePicker
70+
<controls:BindablePicker
7171
Grid.Row="0"
72-
Title="BRAND"
73-
ItemsSource="{Binding Brands}"
72+
Title="BRAND"
73+
ItemsSource="{Binding Brands}"
7474
SelectedItem="{Binding Brand, Mode=TwoWay}"
75-
Style="{StaticResource FilterPickerStyle}"/>
76-
<controls:BindablePicker
75+
Style="{StaticResource FilterPickerStyle}">
76+
<controls:BindablePicker.HeightRequest>
77+
<OnPlatform
78+
x:TypeArguments="x:Double"
79+
Android="48"
80+
iOS="48"
81+
WinPhone="36"/>
82+
</controls:BindablePicker.HeightRequest>
83+
</controls:BindablePicker>
84+
<controls:BindablePicker
7785
Grid.Row="1"
78-
Title="TYPE"
86+
Title="TYPE"
7987
ItemsSource="{Binding Types}"
8088
SelectedItem="{Binding Type, Mode=TwoWay}"
81-
Style="{StaticResource FilterPickerStyle}"/>
89+
Style="{StaticResource FilterPickerStyle}">
90+
<controls:BindablePicker.HeightRequest>
91+
<OnPlatform
92+
x:TypeArguments="x:Double"
93+
Android="48"
94+
iOS="48"
95+
WinPhone="36"/>
96+
</controls:BindablePicker.HeightRequest>
97+
</controls:BindablePicker>
8298
<Button
8399
Grid.Row="2"
84100
Text="Apply"

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,28 @@
124124
Text="User name or email"
125125
Style="{StaticResource HeaderLabelStyle}"/>
126126
<Entry
127-
Text="{Binding UserName.Value, Mode=TwoWay}"/>
127+
Text="{Binding UserName.Value, Mode=TwoWay}">
128+
<Entry.Style>
129+
<OnPlatform x:TypeArguments="Style"
130+
iOS="{StaticResource EntryStyle}"
131+
Android="{StaticResource EntryStyle}"
132+
WinPhone="{StaticResource UwpEntryStyle}"/>
133+
</Entry.Style>
134+
</Entry>
128135
<Label
129136
Text="Password"
130137
Style="{StaticResource HeaderLabelStyle}"/>
131138
<Entry
132139
IsPassword="True"
133-
Text="{Binding Password.Value, Mode=TwoWay}" />
140+
Text="{Binding Password.Value, Mode=TwoWay}"
141+
Style="{StaticResource EntryStyle}">
142+
<Entry.Style>
143+
<OnPlatform x:TypeArguments="Style"
144+
iOS="{StaticResource EntryStyle}"
145+
Android="{StaticResource EntryStyle}"
146+
WinPhone="{StaticResource UwpEntryStyle}"/>
147+
</Entry.Style>
148+
</Entry>
134149
</StackLayout>
135150
<!-- LOGIN BUTTON -->
136151
<Grid

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/MainView.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
xmlns:controls="clr-namespace:eShopOnContainers.Core.Controls;assembly=eShopOnContainers.Core"
77
BarBackgroundColor="{StaticResource DarkGreenColor}"
88
BackgroundColor="{StaticResource BackgroundColor}"
9+
BarTextColor="{StaticResource WhiteColor}"
910
Title="eShop on Containers">
1011
<views:CatalogView
1112
x:Name="HomeView">

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/OrderDetailView.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,14 @@
195195
Grid.Row="2"
196196
Opacity="0">
197197
<Grid.RowDefinitions>
198-
<RowDefinition Height="*" />
198+
<RowDefinition Height="Auto" />
199199
<RowDefinition Height="Auto" />
200200
</Grid.RowDefinitions>
201201
<ListView
202202
Grid.Row="0"
203203
ItemsSource="{Binding Order.OrderItems}"
204204
HasUnevenRows="True"
205205
SeparatorVisibility="None"
206-
VerticalOptions="FillAndExpand"
207206
CachingStrategy="RecycleElement">
208207
<ListView.ItemTemplate>
209208
<DataTemplate>

0 commit comments

Comments
 (0)