private void UpdateBackgorundColor()
        {
            var view = (UISearchBar)Control;

            view.BackgroundColor = Color.Transparent.ToUIColor();
            view.TintColor       = Color.Transparent.ToUIColor();
            view.SetBackgroundImage(new UIImage(), UIBarPosition.Any, UIBarMetrics.Default);

            var textField = GetSubViewOfType <UITextField>(view);

            if (textField != null)
            {
                if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
                {
                    textField.BackgroundColor = UIColor.FromDynamicProvider((traitCollection) =>
                    {
                        return(traitCollection.UserInterfaceStyle == UIUserInterfaceStyle.Dark
                        ? ((Color)App.Current.Resources["LightBackgroundColorDark"]).ToUIColor()
                        : ((Color)App.Current.Resources["DarkBackgroundColorLight"]).ToUIColor());
                    });
                }
                else
                {
                    textField.BackgroundColor = ((Color)App.Current.Resources["DarkBackgroundColorLight"]).ToUIColor();
                }
            }
        }
        private static UIColor SelectDynamicColor(UIColor color, UIColor darkColor)
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
            {
                return(UIColor.FromDynamicProvider((traitCollection) =>
                {
                    return traitCollection.UserInterfaceStyle == UIUserInterfaceStyle.Dark
                    ? darkColor
                    : color;
                }));
            }

            return(color);
        }