Skip to content

Commit d9bb09d

Browse files
committed
[working-with] fonts, make work on Windows Phone
1 parent 820df04 commit d9bb09d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
1.29 KB
Loading

WorkingWithFonts/WorkingWithFonts/FontPageCs.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public class FontPageCs : ContentPage
2525
public FontPageCs ()
2626
{
2727
var label = new Label {
28-
Text = "Hello, Forms!",
28+
Text = "Hello, Xamarin.Forms!",
2929
FontFamily = Device.OnPlatform (
3030
"SF Hollywood Hills",
3131
null,
32-
null
33-
), // set only for iOS
32+
@"\Assets\Fonts\SF Hollywood Hills.ttf#SF Hollywood Hills"
33+
), // set for iOS & Windows Phone (Android done in custom renderer)
3434
VerticalOptions = LayoutOptions.CenterAndExpand,
3535
HorizontalOptions = LayoutOptions.CenterAndExpand,
3636

@@ -42,10 +42,14 @@ public FontPageCs ()
4242
);
4343

4444
var myLabel = new MyLabel {
45-
Text = "MyLabel for Android!",
4645
VerticalOptions = LayoutOptions.CenterAndExpand,
4746
HorizontalOptions = LayoutOptions.CenterAndExpand,
4847
};
48+
myLabel.Text = Device.OnPlatform(
49+
"MyLabel for iOS!",
50+
"MyLabel for Android!",
51+
"MyLabel for Windows Phone!"
52+
);
4953
myLabel.FontSize = Device.OnPlatform (
5054
Device.GetNamedSize (NamedSize.Small, myLabel),
5155
Device.GetNamedSize (NamedSize.Medium, myLabel), // will get overridden in custom Renderer

0 commit comments

Comments
 (0)