Skip to content

Commit 1545eb8

Browse files
David BritchDavid Britch
authored andcommitted
Replaced deprecated OnPlatform API. Fixes dotnet-architecture#399
1 parent 1e5bea9 commit 1545eb8

14 files changed

Lines changed: 277 additions & 310 deletions

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

Lines changed: 110 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -34,148 +34,139 @@
3434
<Color x:Key="AndroidListViewBackgroundColor">Transparent</Color>
3535
<Color x:Key="iOSListViewBackgroundColor">Transparent</Color>
3636

37-
<OnPlatform
38-
x:TypeArguments="Color"
39-
x:Key="ActivityIndicatorColor"
40-
iOS="{ StaticResource iOSDefaultTintColor }" />
37+
<OnPlatform x:TypeArguments="Color"
38+
x:Key="ActivityIndicatorColor">
39+
<On Platform="iOS" Value="{ StaticResource iOSDefaultTintColor }" />
40+
</OnPlatform>
4141

42-
<OnPlatform
43-
x:TypeArguments="Color"
44-
x:Key="DefaultButtonClassBackgroundColor"
45-
Android="{ StaticResource AndroidDefaultButtonClassBackgroundColor }"
46-
iOS="{ StaticResource iOSDefaultButtonClassBackgroundColor }" />
42+
<OnPlatform x:TypeArguments="Color"
43+
x:Key="DefaultButtonClassBackgroundColor">
44+
<On Platform="iOS" Value="{ StaticResource iOSDefaultButtonClassBackgroundColor }" />
45+
<On Platform="Android" Value="{ StaticResource AndroidDefaultButtonClassBackgroundColor }" />
46+
</OnPlatform>
4747

48-
<OnPlatform
49-
x:TypeArguments="Color"
50-
x:Key="DefaultButtonClassBorderColor"
51-
Android="{ StaticResource AndroidDefaultButtonClassBorderColor }"
52-
iOS="{ StaticResource iOSDefaultButtonClassBorderColor }" />
48+
<OnPlatform x:TypeArguments="Color"
49+
x:Key="DefaultButtonClassBorderColor">
50+
<On Platform="iOS" Value="{ StaticResource iOSDefaultButtonClassBorderColor }" />
51+
<On Platform="Android" Value="{ StaticResource AndroidDefaultButtonClassBorderColor }" />
52+
</OnPlatform>
5353

54-
<OnPlatform
55-
x:TypeArguments="Color"
56-
x:Key="DefaultButtonClassTextColor"
57-
Android="{ StaticResource AndroidDefaultButtonClassTextColor }"
58-
iOS="{ StaticResource iOSDefaultButtonClassTextColor }" />
54+
<OnPlatform x:TypeArguments="Color"
55+
x:Key="DefaultButtonClassTextColor">
56+
<On Platform="iOS" Value="{ StaticResource iOSDefaultButtonClassTextColor }" />
57+
<On Platform="Android" Value="{ StaticResource AndroidDefaultButtonClassTextColor }" />
58+
</OnPlatform>
5959

60-
<OnPlatform
61-
x:TypeArguments="Color"
62-
x:Key="EntryBackgroundColor"
63-
Android="{ StaticResource AndroidEntryBackgroundColor }"
64-
iOS="{ StaticResource iOSEntryBackgroundColor }" />
60+
<OnPlatform x:TypeArguments="Color"
61+
x:Key="EntryBackgroundColor">
62+
<On Platform="iOS" Value="{ StaticResource iOSEntryBackgroundColor }" />
63+
<On Platform="Android" Value="{ StaticResource AndroidEntryBackgroundColor }" />
64+
</OnPlatform>
6565

66-
<OnPlatform
67-
x:TypeArguments="Color"
68-
x:Key="ThemeListViewBackgroundColor"
69-
Android="{ StaticResource AndroidListViewBackgroundColor }"
70-
iOS="{ StaticResource iOSListViewBackgroundColor }" />
66+
<OnPlatform x:TypeArguments="Color"
67+
x:Key="ThemeListViewBackgroundColor">
68+
<On Platform="iOS" Value="{ StaticResource iOSListViewBackgroundColor }" />
69+
<On Platform="Android" Value="{ StaticResource AndroidListViewBackgroundColor }" />
70+
</OnPlatform>
7171

7272
<!-- SIZES -->
73-
<OnPlatform
74-
x:TypeArguments="x:Double"
75-
x:Key="BaseButtonBorderRadius"
76-
iOS="6" />
73+
<OnPlatform x:TypeArguments="x:Double"
74+
x:Key="BaseButtonBorderRadius">
75+
<On Platform="iOS" Value="6" />
76+
</OnPlatform>
7777

78-
<OnPlatform
79-
x:TypeArguments="x:Double"
80-
x:Key="BaseButtonBorderWidth"
81-
Android="0"
82-
iOS="0" />
78+
<OnPlatform x:TypeArguments="x:Double"
79+
x:Key="BaseButtonBorderWidth">
80+
<On Platform="iOS, Android" Value="0" />
81+
</OnPlatform>
8382

8483
<!-- FONTS -->
85-
<OnPlatform
86-
x:Key="MontserratRegular"
87-
x:TypeArguments="x:String"
88-
iOS="Montserrat-Regular"
89-
Android="Montserrat-Regular.ttf#Montserrat"
90-
WinPhone="Assets/Fonts/Montserrat-Regular.ttf#Montserrat"/>
84+
<OnPlatform x:Key="MontserratRegular"
85+
x:TypeArguments="x:String">
86+
<On Platform="iOS" Value="Montserrat-Regular" />
87+
<On Platform="Android" Value="Montserrat-Regular.ttf#Montserrat" />
88+
<On Platform="UWP, WinRT, WinPhone" Value="Assets/Fonts/Montserrat-Regular.ttf#Montserrat" />
89+
</OnPlatform>
9190

92-
<OnPlatform
93-
x:Key="MontserratBold"
94-
x:TypeArguments="x:String"
95-
iOS="Montserrat-Bold"
96-
Android="Montserrat-Bold.ttf#Montserrat"
97-
WinPhone="Assets/Fonts/Montserrat-Bold.ttf#Montserrat"/>
91+
<OnPlatform x:Key="MontserratBold"
92+
x:TypeArguments="x:String">
93+
<On Platform="iOS" Value="Montserrat-Bold" />
94+
<On Platform="Android" Value="Montserrat-Bold.ttf#Montserrat" />
95+
<On Platform="UWP, WinRT, WinPhone" Value="Assets/Fonts/Montserrat-Bold.ttf#Montserrat" />
96+
</OnPlatform>
9897

99-
<OnPlatform
100-
x:Key="SourceSansProRegular"
101-
x:TypeArguments="x:String"
102-
iOS="SourceSansPro-Regular"
103-
Android="SourceSansPro-Regular.ttf#Source Sans Pro"
104-
WinPhone="Assets/Fonts/SourceSansPro-Regular.ttf#Source Sans Pro"/>
98+
<OnPlatform x:Key="SourceSansProRegular"
99+
x:TypeArguments="x:String">
100+
<On Platform="iOS" Value="SourceSansPro-Regular" />
101+
<On Platform="Android" Value="SourceSansPro-Regular.ttf#Source Sans Pro" />
102+
<On Platform="UWP, WinRT, WinPhone" Value="Assets/Fonts/SourceSansPro-Regular.ttf#Source Sans Pro" />
103+
</OnPlatform>
105104

106-
<OnPlatform
107-
x:TypeArguments="x:Double"
108-
x:Key="BaseButtonFontSize"
109-
Android="16"
110-
iOS="18" />
105+
<OnPlatform x:TypeArguments="x:Double"
106+
x:Key="BaseButtonFontSize">
107+
<On Platform="iOS" Value="18" />
108+
<On Platform="Android" Value="16" />
109+
</OnPlatform>
111110

112-
<OnPlatform
113-
x:TypeArguments="x:Double"
114-
x:Key="BaseFontSize"
115-
Android="15"
116-
iOS="16" />
111+
<OnPlatform x:TypeArguments="x:Double"
112+
x:Key="BaseFontSize">
113+
<On Platform="iOS" Value="16" />
114+
<On Platform="Android" Value="15" />
115+
</OnPlatform>
117116

118-
<OnPlatform
119-
x:Key="LittleSize"
120-
x:TypeArguments="x:Double"
121-
iOS="11"
122-
Android="12"
123-
WinPhone="12"/>
117+
<OnPlatform x:Key="LittleSize"
118+
x:TypeArguments="x:Double">
119+
<On Platform="iOS" Value="11" />
120+
<On Platform="Android, UWP, WinRT, WinPhone" Value="12" />
121+
</OnPlatform>
124122

125-
<OnPlatform
126-
x:Key="MidMediumSize"
127-
x:TypeArguments="x:Double"
128-
iOS="12"
129-
Android="14"
130-
WinPhone="14"/>
123+
<OnPlatform x:Key="MidMediumSize"
124+
x:TypeArguments="x:Double">
125+
<On Platform="iOS" Value="12" />
126+
<On Platform="Android, UWP, WinRT, WinPhone" Value="14" />
127+
</OnPlatform>
131128

132-
<OnPlatform
133-
x:Key="MediumSize"
134-
x:TypeArguments="x:Double"
135-
iOS="14"
136-
Android="16"
137-
WinPhone="16"/>
129+
<OnPlatform x:Key="MediumSize"
130+
x:TypeArguments="x:Double">
131+
<On Platform="iOS" Value="14" />
132+
<On Platform="Android, UWP, WinRT, WinPhone" Value="16" />
133+
</OnPlatform>
138134

139-
<OnPlatform
140-
x:Key="LargeSize"
141-
x:TypeArguments="x:Double"
142-
iOS="16"
143-
Android="18"
144-
WinPhone="18"/>
135+
<OnPlatform x:Key="LargeSize"
136+
x:TypeArguments="x:Double">
137+
<On Platform="iOS" Value="16" />
138+
<On Platform="Android, UWP, WinRT, WinPhone" Value="18" />
139+
</OnPlatform>
145140

146-
<OnPlatform
147-
x:Key="LargerSize"
148-
x:TypeArguments="x:Double"
149-
iOS="18"
150-
Android="20"
151-
WinPhone="20"/>
141+
<OnPlatform x:Key="LargerSize"
142+
x:TypeArguments="x:Double">
143+
<On Platform="iOS" Value="18" />
144+
<On Platform="Android, UWP, WinRT, WinPhone" Value="20" />
145+
</OnPlatform>
152146

153-
<OnPlatform
154-
x:Key="BigSize"
155-
x:TypeArguments="x:Double"
156-
iOS="20"
157-
Android="24"
158-
WinPhone="24"/>
147+
<OnPlatform x:Key="BigSize"
148+
x:TypeArguments="x:Double">
149+
<On Platform="iOS" Value="20" />
150+
<On Platform="Android, UWP, WinRT, WinPhone" Value="24" />
151+
</OnPlatform>
159152

160-
<OnPlatform
161-
x:Key="ExtraBigSize"
162-
x:TypeArguments="x:Double"
163-
iOS="24"
164-
Android="32"
165-
WinPhone="32"/>
153+
<OnPlatform x:Key="ExtraBigSize"
154+
x:TypeArguments="x:Double">
155+
<On Platform="iOS" Value="24" />
156+
<On Platform="Android, UWP, WinRT, WinPhone" Value="32" />
157+
</OnPlatform>
166158

167-
<OnPlatform
168-
x:Key="HugeSize"
169-
x:TypeArguments="x:Double"
170-
iOS="32"
171-
Android="48"
172-
WinPhone="48"/>
159+
<OnPlatform x:Key="HugeSize"
160+
x:TypeArguments="x:Double">
161+
<On Platform="iOS" Value="32" />
162+
<On Platform="Android, UWP, WinRT, WinPhone" Value="48" />
163+
</OnPlatform>
173164

174-
<OnPlatform
175-
x:TypeArguments="FontAttributes"
176-
x:Key="BaseButtonFontAttributes"
177-
Android="None"
178-
iOS="Bold" />
165+
<OnPlatform x:TypeArguments="FontAttributes"
166+
x:Key="BaseButtonFontAttributes">
167+
<On Platform="iOS" Value="Bold" />
168+
<On Platform="Android" Value="None" />
169+
</OnPlatform>
179170

180171
<!-- CONVERTERS -->
181172
<converters:CountToBoolConverter x:Key="CountToBoolConverter" />

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Controls/AddBasketButton.xaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@
4444
<!-- ANDROID -->
4545
<Grid>
4646
<Grid.IsVisible>
47-
<OnPlatform
48-
x:TypeArguments="x:Boolean"
49-
Android="True"
50-
iOS="True"
51-
WinPhone="False"/>
47+
<OnPlatform x:TypeArguments="x:Boolean">
48+
<On Platform="iOS, Android" Value="True" />
49+
<On Platform="UWP, WinRT, WinPhone" Value="False" />
50+
</OnPlatform>
5251
</Grid.IsVisible>
5352
<BoxView
5453
BackgroundColor="{StaticResource LightGreenColor}"
@@ -64,11 +63,10 @@
6463
<!-- IOS & UWP -->
6564
<Grid>
6665
<Grid.IsVisible>
67-
<OnPlatform
68-
x:TypeArguments="x:Boolean"
69-
Android="False"
70-
iOS="False"
71-
WinPhone="True"/>
66+
<OnPlatform x:TypeArguments="x:Boolean">
67+
<On Platform="iOS, Android" Value="False" />
68+
<On Platform="UWP, WinRT, WinPhone" Value="True" />
69+
</OnPlatform>
7270
</Grid.IsVisible>
7371
<Image
7472
Source="Assets\circle_button_background.png"

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,10 @@
171171
VerticalOptions="Center"
172172
HorizontalOptions="Center">
173173
<ActivityIndicator.WidthRequest>
174-
<OnPlatform
175-
x:TypeArguments="x:Double"
176-
iOS="100"
177-
Android="100"
178-
WinPhone="400" />
174+
<OnPlatform x:TypeArguments="x:Double">
175+
<On Platform="iOS, Android" Value="100" />
176+
<On Platform="UWP, WinRT, WinPhone" Value="400" />
177+
</OnPlatform>
179178
</ActivityIndicator.WidthRequest>
180179
</ActivityIndicator>
181180
</Grid>

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@
9090
VerticalOptions="Center"
9191
HorizontalOptions="Center">
9292
<ActivityIndicator.WidthRequest>
93-
<OnPlatform
94-
x:TypeArguments="x:Double"
95-
iOS="100"
96-
Android="100"
97-
WinPhone="400" />
93+
<OnPlatform x:TypeArguments="x:Double">
94+
<On Platform="iOS, Android" Value="100" />
95+
<On Platform="UWP, WinRT, WinPhone" Value="400" />
96+
</OnPlatform>
9897
</ActivityIndicator.WidthRequest>
9998
</ActivityIndicator>
10099
</Grid>

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,10 @@
114114
VerticalOptions="Center"
115115
HorizontalOptions="Center">
116116
<ActivityIndicator.WidthRequest>
117-
<OnPlatform
118-
x:TypeArguments="x:Double"
119-
iOS="100"
120-
Android="100"
121-
WinPhone="400" />
117+
<OnPlatform x:TypeArguments="x:Double">
118+
<On Platform="iOS, Android" Value="100" />
119+
<On Platform="UWP, WinRT, WinPhone" Value="400" />
120+
</OnPlatform>
122121
</ActivityIndicator.WidthRequest>
123122
</ActivityIndicator>
124123
</Grid>

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,10 @@
231231
VerticalOptions="Center"
232232
HorizontalOptions="Center">
233233
<ActivityIndicator.WidthRequest>
234-
<OnPlatform
235-
x:TypeArguments="x:Double"
236-
iOS="100"
237-
Android="100"
238-
WinPhone="400" />
234+
<OnPlatform x:TypeArguments="x:Double">
235+
<On Platform="iOS, Android" Value="100" />
236+
<On Platform="UWP, WinRT, WinPhone" Value="400" />
237+
</OnPlatform>
239238
</ActivityIndicator.WidthRequest>
240239
</ActivityIndicator>
241240
</Grid>

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@
7676
SelectedItem="{Binding Brand, Mode=TwoWay}"
7777
Style="{StaticResource FilterPickerStyle}">
7878
<Picker.HeightRequest>
79-
<OnPlatform
80-
x:TypeArguments="x:Double"
81-
Android="48"
82-
iOS="48"
83-
WinPhone="36"/>
79+
<OnPlatform x:TypeArguments="x:Double">
80+
<On Platform="iOS, Android" Value="48" />
81+
<On Platform="UWP, WinRT, WinPhone" Value="36" />
82+
</OnPlatform>
8483
</Picker.HeightRequest>
8584
</Picker>
8685
<!-- TYPE -->
@@ -91,11 +90,10 @@
9190
SelectedItem="{Binding Type, Mode=TwoWay}"
9291
Style="{StaticResource FilterPickerStyle}">
9392
<Picker.HeightRequest>
94-
<OnPlatform
95-
x:TypeArguments="x:Double"
96-
Android="48"
97-
iOS="48"
98-
WinPhone="36"/>
93+
<OnPlatform x:TypeArguments="x:Double">
94+
<On Platform="iOS, Android" Value="48" />
95+
<On Platform="UWP, WinRT, WinPhone" Value="36" />
96+
</OnPlatform>
9997
</Picker.HeightRequest>
10098
</Picker>
10199
<Button

0 commit comments

Comments
 (0)