From a11b081510b247552cbae289f4800eff31fefb7e Mon Sep 17 00:00:00 2001 From: logikonline Date: Fri, 16 Jan 2026 05:39:10 +0000 Subject: [PATCH] more searchBar --- Handlers/SearchBarHandler.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Handlers/SearchBarHandler.cs b/Handlers/SearchBarHandler.cs index 7f56930..12093f8 100644 --- a/Handlers/SearchBarHandler.cs +++ b/Handlers/SearchBarHandler.cs @@ -18,9 +18,11 @@ public partial class SearchBarHandler : ViewHandler [nameof(ITextInput.Text)] = MapText, [nameof(ITextStyle.TextColor)] = MapTextColor, [nameof(ITextStyle.Font)] = MapFont, + [nameof(ITextStyle.CharacterSpacing)] = MapCharacterSpacing, [nameof(IPlaceholder.Placeholder)] = MapPlaceholder, [nameof(IPlaceholder.PlaceholderColor)] = MapPlaceholderColor, [nameof(ISearchBar.CancelButtonColor)] = MapCancelButtonColor, + [nameof(ISearchBar.HorizontalTextAlignment)] = MapHorizontalTextAlignment, [nameof(IView.Background)] = MapBackground, }; @@ -93,10 +95,28 @@ public partial class SearchBarHandler : ViewHandler var font = searchBar.Font; if (font.Size > 0) - handler.PlatformView.FontSize = (float)font.Size; + handler.PlatformView.FontSize = font.Size; if (!string.IsNullOrEmpty(font.Family)) handler.PlatformView.FontFamily = font.Family; + + // Map FontAttributes from the Font weight + var attrs = FontAttributes.None; + if (font.Weight >= FontWeight.Bold) + attrs |= FontAttributes.Bold; + handler.PlatformView.FontAttributes = attrs; + } + + public static void MapCharacterSpacing(SearchBarHandler handler, ISearchBar searchBar) + { + if (handler.PlatformView is null) return; + handler.PlatformView.CharacterSpacing = searchBar.CharacterSpacing; + } + + public static void MapHorizontalTextAlignment(SearchBarHandler handler, ISearchBar searchBar) + { + if (handler.PlatformView is null) return; + handler.PlatformView.HorizontalTextAlignment = searchBar.HorizontalTextAlignment; } public static void MapPlaceholder(SearchBarHandler handler, ISearchBar searchBar)