diff --git a/src/Core/src/Handlers/Label/LabelHandler.Tizen.cs b/src/Core/src/Handlers/Label/LabelHandler.Tizen.cs index e689c598eac5..8843fb8a6a8f 100644 --- a/src/Core/src/Handlers/Label/LabelHandler.Tizen.cs +++ b/src/Core/src/Handlers/Label/LabelHandler.Tizen.cs @@ -43,6 +43,11 @@ public static void MapFont(ILabelHandler handler, ILabel label) handler.PlatformView?.UpdateFont(label, fontManager); } + public static void MapShadow(ILabelHandler handler, ILabel label) + { + handler.PlatformView?.UpdateShadow(label); + } + [MissingMapper] public static void MapCharacterSpacing(ILabelHandler handler, ILabel label) { } diff --git a/src/Core/src/Handlers/Label/LabelHandler.cs b/src/Core/src/Handlers/Label/LabelHandler.cs index d57c2e02fa85..a20e52ee2010 100644 --- a/src/Core/src/Handlers/Label/LabelHandler.cs +++ b/src/Core/src/Handlers/Label/LabelHandler.cs @@ -24,6 +24,9 @@ public partial class LabelHandler : ILabelHandler [nameof(ILabel.Background)] = MapBackground, [nameof(ILabel.Height)] = MapHeight, [nameof(ILabel.Opacity)] = MapOpacity, +#endif +#if TIZEN + [nameof(ILabel.Shadow)] = MapShadow, #endif [nameof(ITextStyle.CharacterSpacing)] = MapCharacterSpacing, [nameof(ITextStyle.Font)] = MapFont, diff --git a/src/Core/src/Handlers/View/ViewHandlerOfT.Tizen.cs b/src/Core/src/Handlers/View/ViewHandlerOfT.Tizen.cs index ef95e3941f02..48e1ff5fecd5 100644 --- a/src/Core/src/Handlers/View/ViewHandlerOfT.Tizen.cs +++ b/src/Core/src/Handlers/View/ViewHandlerOfT.Tizen.cs @@ -114,6 +114,8 @@ protected override void RemoveContainer() var parent = ContainerView!.GetParent(); parent?.Remove(ContainerView!); ContainerView.Content = null; + ContainerView.Dispose(); + ContainerView = null; parent?.Add(PlatformView); PlatformView.UpdateBounds(bounds); } diff --git a/src/Core/src/Platform/Tizen/LabelExtensions.cs b/src/Core/src/Platform/Tizen/LabelExtensions.cs index 264d543b0b80..f5edf093f069 100644 --- a/src/Core/src/Platform/Tizen/LabelExtensions.cs +++ b/src/Core/src/Platform/Tizen/LabelExtensions.cs @@ -2,6 +2,9 @@ using Tizen.UIExtensions.NUI; using TLineBreakMode = Tizen.UIExtensions.Common.LineBreakMode; using TTextDecorationse = Tizen.UIExtensions.Common.TextDecorations; +using Microsoft.Maui.Graphics; +using Tizen.NUI; +using NColor = Tizen.UIExtensions.Common.Color; namespace Microsoft.Maui.Platform { @@ -14,7 +17,7 @@ public static void UpdateText(this Label platformLabel, ILabel label) public static void UpdateTextColor(this Label platformLabel, ILabel label) { - platformLabel.TextColor = label.TextColor == null ? Color.Black : label.TextColor.ToPlatform(); + platformLabel.TextColor = label.TextColor == null ? NColor.Black : label.TextColor.ToPlatform(); } public static void UpdateFont(this Label platformLabel, ILabel label, IFontManager fontManager) @@ -39,6 +42,29 @@ public static void UpdateTextDecorations(this Label platformLabel, ILabel label) platformLabel.TextDecorations = label.TextDecorations.ToPlatform(); } + public static void UpdateShadow(this Label platformLabel, IView view) + { + if (view.Shadow != null) + { + var offsetX = view.Shadow.Offset.X.ToScaledPixel(); + var offsetY = view.Shadow.Offset.Y.ToScaledPixel(); + var radius = ((double)view.Shadow.Radius).ToScaledPixel(); + var color = view.Shadow.Paint.ToColor() != null ? view.Shadow.Paint.ToColor()!.MultiplyAlpha(view.Shadow.Opacity) : Colors.Black.MultiplyAlpha(view.Shadow.Opacity); + var ncolor = color.ToPlatform().ToNative(); + + PropertyMap shadow = new PropertyMap(); + shadow.Add("offset", new PropertyValue(new Vector2(offsetX, offsetY))); + shadow.Add("color", new PropertyValue(ncolor)); + shadow.Add("blurRadius", new PropertyValue(radius)); + + platformLabel.Shadow = shadow; + } + else + { + platformLabel.Shadow = new PropertyMap(); + } + } + public static FontAttributes GetFontAttributes(this Font font) { FontAttributes attributes = font.Weight == FontWeight.Bold ? FontAttributes.Bold : FontAttributes.None;