summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT
diff options
context:
space:
mode:
authorPaul DiPietro <pauldipietro@users.noreply.github.com>2016-08-30 18:47:09 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-08-30 18:47:09 (GMT)
commitd8f9444ddb3e49b408a5431acf6fa43a226c434e (patch)
treee4fc7bcde77cac87834a79c49d32b193605207b5 /Xamarin.Forms.Platform.WinRT
parent88b15d7d1f40a19d35ed5daed16bdfe2a32adc76 (diff)
downloadxamarin-forms-d8f9444ddb3e49b408a5431acf6fa43a226c434e.zip
xamarin-forms-d8f9444ddb3e49b408a5431acf6fa43a226c434e.tar.gz
xamarin-forms-d8f9444ddb3e49b408a5431acf6fa43a226c434e.tar.bz2
[Win] Fix FontAttributes unexpectedly changing a label's size (#325)
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT')
-rw-r--r--Xamarin.Forms.Platform.WinRT/LabelRenderer.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/LabelRenderer.cs b/Xamarin.Forms.Platform.WinRT/LabelRenderer.cs
index 1f2f861..3997e7e 100644
--- a/Xamarin.Forms.Platform.WinRT/LabelRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT/LabelRenderer.cs
@@ -34,6 +34,7 @@ namespace Xamarin.Forms.Platform.WinRT
public class LabelRenderer : ViewRenderer<Label, TextBlock>
{
bool _fontApplied;
+ bool _isInitiallyDefault;
protected override Windows.Foundation.Size ArrangeOverride(Windows.Foundation.Size finalSize)
{
@@ -71,6 +72,8 @@ namespace Xamarin.Forms.Platform.WinRT
SetNativeControl(new TextBlock());
}
+ _isInitiallyDefault = Element.IsDefault();
+
UpdateText(Control);
UpdateColor(Control);
UpdateAlign(Control);
@@ -134,7 +137,7 @@ namespace Xamarin.Forms.Platform.WinRT
return;
#pragma warning disable 618
- Font fontToApply = label.IsDefault() ? Font.SystemFontOfSize(NamedSize.Medium) : label.Font;
+ Font fontToApply = label.IsDefault() && _isInitiallyDefault ? Font.SystemFontOfSize(NamedSize.Medium) : label.Font;
#pragma warning restore 618
textBlock.ApplyFont(fontToApply);