Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compatibility/Core/src/WinUI/LabelRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void UpdateTextDecorations(TextBlock textBlock)

}

[PortHandler("Partially ported")]
[PortHandler]
void UpdateAlign(TextBlock textBlock)
{
_perfectSizeValid = false;
Expand Down
3 changes: 3 additions & 0 deletions src/Core/src/Handlers/Label/LabelHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public static void MapHorizontalTextAlignment(LabelHandler handler, ILabel label
handler.NativeView?.UpdateHorizontalTextAlignment(label);
}

[MissingMapper]
public static void MapVerticalTextAlignment(LabelHandler handler, ILabel label) { }

public static void MapLineBreakMode(LabelHandler handler, ILabel label)
{
handler.NativeView?.UpdateLineBreakMode(label);
Expand Down
1 change: 1 addition & 0 deletions src/Core/src/Handlers/Label/LabelHandler.Standard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public static void MapTextColor(IViewHandler handler, ILabel label) { }
public static void MapCharacterSpacing(IViewHandler handler, ILabel label) { }
public static void MapFont(LabelHandler handler, ILabel label) { }
public static void MapHorizontalTextAlignment(LabelHandler handler, ILabel label) { }
public static void MapVerticalTextAlignment(LabelHandler handler, ILabel label) { }
public static void MapLineBreakMode(LabelHandler handler, ILabel label) { }
public static void MapTextDecorations(LabelHandler handler, ILabel label) { }
public static void MapMaxLines(IViewHandler handler, ILabel label) { }
Expand Down
9 changes: 6 additions & 3 deletions src/Core/src/Handlers/Label/LabelHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ public static void MapFont(LabelHandler handler, ILabel label)
handler.NativeView?.UpdateFont(label, fontManager);
}

public static void MapHorizontalTextAlignment(LabelHandler handler, ILabel label) =>
public static void MapHorizontalTextAlignment(LabelHandler handler, ILabel label) =>
handler.NativeView?.UpdateHorizontalTextAlignment(label);

public static void MapLineBreakMode(LabelHandler handler, ILabel label) =>
public static void MapVerticalTextAlignment(LabelHandler handler, ILabel label) =>
handler.NativeView?.UpdateVerticalTextAlignment(label);

public static void MapLineBreakMode(LabelHandler handler, ILabel label) =>
handler.NativeView?.UpdateLineBreakMode(label);

public static void MapTextDecorations(LabelHandler handler, ILabel label) =>
Expand All @@ -49,7 +52,7 @@ public static void MapMaxLines(LabelHandler handler, ILabel label) =>
public static void MapPadding(LabelHandler handler, ILabel label) =>
handler.NativeView?.UpdatePadding(label);

public static void MapLineHeight(LabelHandler handler, ILabel label) =>
public static void MapLineHeight(LabelHandler handler, ILabel label) =>
handler.NativeView?.UpdateLineHeight(label);
}
}
1 change: 1 addition & 0 deletions src/Core/src/Handlers/Label/LabelHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public partial class LabelHandler
[nameof(ILabel.CharacterSpacing)] = MapCharacterSpacing,
[nameof(ILabel.Font)] = MapFont,
[nameof(ILabel.HorizontalTextAlignment)] = MapHorizontalTextAlignment,
[nameof(ILabel.VerticalTextAlignment)] = MapVerticalTextAlignment,
[nameof(ILabel.LineBreakMode)] = MapLineBreakMode,
[nameof(ILabel.LineHeight)] = MapLineHeight,
[nameof(ILabel.MaxLines)] = MapMaxLines,
Expand Down
3 changes: 3 additions & 0 deletions src/Core/src/Handlers/Label/LabelHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public static void MapHorizontalTextAlignment(LabelHandler handler, ILabel label
handler.NativeView?.UpdateHorizontalTextAlignment(label);
}

[MissingMapper]
public static void MapVerticalTextAlignment(LabelHandler handler, ILabel label) { }

public static void MapLineBreakMode(LabelHandler handler, ILabel label)
{
handler.NativeView?.UpdateLineBreakMode(label);
Expand Down
13 changes: 13 additions & 0 deletions src/Core/src/Platform/Windows/AlignmentExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ public static HorizontalAlignment ToNativeHorizontalAlignment(this TextAlignment
}
}

public static VerticalAlignment ToNativeVerticalAlignment(this TextAlignment alignment)
{
switch (alignment)
{
case TextAlignment.Center:
return VerticalAlignment.Center;
case TextAlignment.End:
return VerticalAlignment.Bottom;
default:
return VerticalAlignment.Top;
}
}

public static UI.Xaml.TextAlignment ToNative(this TextAlignment alignment, bool isLtr = true)
{
switch (alignment)
Expand Down
5 changes: 5 additions & 0 deletions src/Core/src/Platform/Windows/TextBlockExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public static void UpdateHorizontalTextAlignment(this TextBlock nativeControl, I
nativeControl.TextAlignment = label.HorizontalTextAlignment.ToNative(true);
}

public static void UpdateVerticalTextAlignment(this TextBlock nativeControl, ILabel label)
{
nativeControl.VerticalAlignment = label.VerticalTextAlignment.ToNativeVerticalAlignment();
}

public static void UpdateLineBreakMode(this TextBlock nativeControl, ILabel label)
{
var lineBreakMode = label.LineBreakMode;
Expand Down