summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xamarin.Forms.Core/Entry.cs24
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs12
2 files changed, 22 insertions, 14 deletions
diff --git a/Xamarin.Forms.Core/Entry.cs b/Xamarin.Forms.Core/Entry.cs
index 46cd774..c891456 100644
--- a/Xamarin.Forms.Core/Entry.cs
+++ b/Xamarin.Forms.Core/Entry.cs
@@ -88,25 +88,21 @@ namespace Xamarin.Forms
set { SetValue(FontSizeProperty, value); }
}
- void IFontElement.OnFontFamilyChanged(string oldValue, string newValue)
- {
- }
-
- void IFontElement.OnFontSizeChanged(double oldValue, double newValue)
- {
- }
-
double IFontElement.FontSizeDefaultValueCreator() =>
Device.GetNamedSize(NamedSize.Default, (Entry)this);
- void IFontElement.OnFontAttributesChanged(FontAttributes oldValue, FontAttributes newValue)
- {
- }
+ void IFontElement.OnFontAttributesChanged(FontAttributes oldValue, FontAttributes newValue) =>
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
- void IFontElement.OnFontChanged(Font oldValue, Font newValue)
- {
- }
+ void IFontElement.OnFontFamilyChanged(string oldValue, string newValue) =>
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
+
+ void IFontElement.OnFontSizeChanged(double oldValue, double newValue) =>
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
+ void IFontElement.OnFontChanged(Font oldValue, Font newValue) =>
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
+
public event EventHandler Completed;
public event EventHandler<TextChangedEventArgs> TextChanged;
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
index 83a7b5d..c240dd5 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
@@ -17,6 +17,18 @@ namespace Xamarin.Forms.Platform.iOS
Frame = new RectangleF(0, 20, 320, 40);
}
+ public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
+ {
+ //with borderStyle set to RoundedRect, iOS always returns a height of 30
+ //https://stackoverflow.com/a/36569247/1063783
+ //we get the current value, and restor it, to allow custom renderers to change the border style
+ var borderStyle = Control.BorderStyle;
+ Control.BorderStyle = UITextBorderStyle.None;
+ var size = Control.GetSizeRequest(widthConstraint, double.PositiveInfinity);
+ Control.BorderStyle = borderStyle;
+ return size;
+ }
+
IElementController ElementController => Element as IElementController;
protected override void Dispose(bool disposing)