I have a Searchar Control. On my Galaxy s4 it's with a grey background color. On the nexus it has a white background color.
Do I need a custom renderer?
For now I have:
public class StyledSearchbar : SearchBar
{
public Color farbe { get; set; }
}
this simple searchbar:
StyledSearchbar searchBar = new StyledSearchbar
{
Placeholder = "Suche",
Scale = 0.9,
//HorizontalOptions = LayoutOptions.FillAndExpand,
WidthRequest = 310,
};
and my custom renderer:
[assembly: ExportRenderer(typeof(StyledSearchbar), typeof(StyledSearchBarRenderer))]
namespace ZF.Droid
{
class StyledSearchBarRenderer : SearchBarRenderer {
protected override void OnElementChanged(ElementChangedEventArgs<SearchBar> e)
{
base.OnElementChanged(e);
var styledSearchbar = (StyledSearchbar)Element;
styledSearchbar.BackgroundColor = Xamarin.Forms.Color.Red;
}
}
}