diff --git a/Ooui.Forms/Extensions/FontExtensions.cs b/Ooui.Forms/Extensions/FontExtensions.cs index 8c53312..f364559 100644 --- a/Ooui.Forms/Extensions/FontExtensions.cs +++ b/Ooui.Forms/Extensions/FontExtensions.cs @@ -83,6 +83,19 @@ namespace Ooui.Forms.Extensions } } + public static string ToOouiVerticalAlign (this TextAlignment align) + { + switch (align) { + case TextAlignment.Start: + default: + return "top"; + case TextAlignment.Center: + return "middle"; + case TextAlignment.End: + return "bottom"; + } + } + static readonly double[] CharacterProportions = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.27799999713897705, 0.27799999713897705, 0.27799999713897705, 0.27799999713897705, 0.27799999713897705, 0, 0, diff --git a/Ooui.Forms/Renderers/LabelRenderer.cs b/Ooui.Forms/Renderers/LabelRenderer.cs index 9be0486..85ddc50 100644 --- a/Ooui.Forms/Renderers/LabelRenderer.cs +++ b/Ooui.Forms/Renderers/LabelRenderer.cs @@ -103,8 +103,10 @@ namespace Ooui.Forms.Renderers void UpdateAlignment () { + this.Style.Display = "table"; + Control.Style.Display = "table-cell"; this.Style.TextAlign = Element.HorizontalTextAlignment.ToOouiTextAlign (); - this.Style.VerticalAlign = Element.VerticalTextAlignment.ToOouiTextAlign (); + Control.Style.VerticalAlign = Element.VerticalTextAlignment.ToOouiVerticalAlign (); } void UpdateLineBreakMode ()