This shouldn't be hard to implement and will make it possible to use ASB with themed apps where the default Android colors like TextColorPrimary may not be quite what the control expects.
public Color DropDownTextColor
{
get => (Color)GetValue(DropDownTextColorProperty);
set => SetValue(DropDownTextColorProperty, value);
}
public static readonly BindableProperty DropDownTextColorProperty =
BindableProperty.Create(
nameof(DropDownTextColor),
typeof(Color),
typeof(AutoSuggestBox),
Colors.Black);
public Color DropDownBackgroundColor
{
get => (Color)GetValue(DropDownBackgroundColorProperty);
set => SetValue(DropDownBackgroundColorProperty, value);
}
public static readonly BindableProperty DropDownBackgroundColorProperty =
BindableProperty.Create(
nameof(DropDownBackgroundColor),
typeof(Color),
typeof(AutoSuggestBox),
Colors.White);
And then e.g. on Android, something like this in SuggestCompleteAdapter:
public override Android.Views.View GetView(int position, Android.Views.View? convertView, ViewGroup parent)
{
return GetDropDownView(position, convertView, parent);
}
public override Android.Views.View GetDropDownView(int position, Android.Views.View? convertView, ViewGroup? parent)
{
const int DefaultPaddingDp = 12;
float density = Context?.Resources?.DisplayMetrics?.Density ?? 1f;
int padding = (int)(DefaultPaddingDp * density);
TextView textView = convertView as TextView ?? new TextView(Context);
textView.Text = labelFunc!(GetObject(position));
textView.SetPadding(padding, padding, padding, padding);
textView.SetTextColor(textColor);
textView.SetBackgroundColor(backgroundColor);
textView.TextSize = 16;
return textView;
}
This shouldn't be hard to implement and will make it possible to use ASB with themed apps where the default Android colors like
TextColorPrimarymay not be quite what the control expects.And then e.g. on Android, something like this in
SuggestCompleteAdapter: