0

I have a problem with styling the SearchBar for Windows phone. The font size is just unbearably huge and there is not property I can set directly. I've read a bit upon custom renederers (though I believe that's just overkill if I jsut wanted to set font size imho) but I really don't know how to even begin and it's the only thing now that's holding me back from being able to deploy to Windows Phone. I tried searching for it but uncle Google sadly let me down on this one. Any help is of course greatly appreciated.

Screenshot:

Screenshot

Community
  • 1
  • 1
Paradox Code
  • 148
  • 2
  • 14
  • All I can think of, is to create a custom render which uses the `SearchBar`'s renderer as a base, and then implement the `TextSize` (or whatever it's called) property. – Johan Sep 08 '15 at 08:55
  • But that seems more like a work around to something else that is wrong. – Johan Sep 08 '15 at 08:55
  • It's what I did in the end anyway since I was left with no choice anyway. Why they couldn't implement these basic features is just beyond me. Oh well, sometimes it's just a bitter pill to swallow :D – Paradox Code Sep 09 '15 at 05:12

2 Answers2

1

Unfortunately, the documentation says it has no property to change the font size. So you do not have another option that implementarte a custom render for that control.

It could be that your cell had changed the size of the system font to a larger size?

Documentation: https://developer.xamarin.com/api/type/Xamarin.Forms.SearchBar/

Examples: https://forums.xamarin.com/discussion/27424/simple-custom-renderer-of-searchbar-android

Iván Oliver
  • 126
  • 3
1

if you are using xaml then you can control style for different platforms like this:

<SearchBar x:Name="Search"
           Placeholder="Search"    
           TextChanged="SearchBar_OnTextChanged"  
           SearchButtonPressed="OnSearch" BackgroundColor="#19588F">
         <SearchBar.FontSize>
             <OnPlatform x:TypeArguments="x:Double"
                         WinPhone="10"
                         Android="22"
                         iOS="20" />
         </SearchBar.FontSize>
 </SearchBar>  
Himanshu Dwivedi
  • 7,934
  • 3
  • 31
  • 52