public static void UpdateText(this SearchView searchView, ISearchBar searchBar)
 {
     searchView.SetQuery(searchBar.Text, false);
 }
 public static void UpdateCharacterSpacing(this AutoSuggestBox platformControl, ISearchBar searchBar)
 {
     platformControl.CharacterSpacing = searchBar.CharacterSpacing.ToEm();
 }
 public static void UpdatePlaceholder(this SearchView searchView, ISearchBar searchBar)
 {
     searchView.QueryHint = searchBar.Placeholder;
 }
Exemple #4
0
 public static void UpdatePlaceholder(this UISearchBar uiSearchBar, ISearchBar searchBar)
 {
     uiSearchBar.Placeholder = searchBar.Placeholder;
 }
        public static void UpdateVerticalTextAlignment(this AutoSuggestBox platformControl, ISearchBar searchBar, MauiSearchTextBox?queryTextBox)
        {
            if (queryTextBox == null)
            {
                return;
            }

            queryTextBox.VerticalAlignment = searchBar.VerticalTextAlignment.ToPlatformVerticalAlignment();
        }
 public static void UpdateIsReadOnly(this UISearchBar uiSearchBar, ISearchBar searchBar)
 {
     uiSearchBar.UserInteractionEnabled = !searchBar.IsReadOnly;
 }
Exemple #7
0
        public static void UpdateIsTextPredictionEnabled(this UISearchBar uiSearchBar, ISearchBar searchBar, UITextField?textField)
        {
            textField ??= uiSearchBar.GetSearchTextField();

            if (textField == null)
            {
                return;
            }

            if (searchBar.IsTextPredictionEnabled)
            {
                textField.AutocorrectionType = UITextAutocorrectionType.Yes;
            }
            else
            {
                textField.AutocorrectionType = UITextAutocorrectionType.No;
            }
        }
        public static void UpdateCancelButtonColor(this AutoSuggestBox platformControl, ISearchBar searchBar, MauiCancelButton?cancelButton, Brush?defaultDeleteButtonBackgroundColorBrush, Brush?defaultDeleteButtonForegroundColorBrush)
        {
            if (cancelButton == null || !cancelButton.IsReady)
            {
                return;
            }

            Color cancelColor = searchBar.CancelButtonColor;

            BrushHelpers.UpdateColor(cancelColor, ref defaultDeleteButtonForegroundColorBrush,
                                     () => cancelButton.ForegroundBrush, brush => cancelButton.ForegroundBrush = brush);

            if (cancelColor == null)
            {
                BrushHelpers.UpdateColor(null, ref defaultDeleteButtonBackgroundColorBrush,
                                         () => cancelButton.BackgroundBrush, brush => cancelButton.BackgroundBrush = brush);
            }
            else
            {
                // Determine whether the background should be black or white (in order to make the foreground color visible)
                var bcolor = cancelColor.ToWindowsColor().GetContrastingColor().ToColor();
                BrushHelpers.UpdateColor(bcolor, ref defaultDeleteButtonBackgroundColorBrush,
                                         () => cancelButton.BackgroundBrush, brush => cancelButton.BackgroundBrush = brush);
            }
        }
 public static void UpdatePlaceholder(this AutoSuggestBox platformControl, ISearchBar searchBar)
 {
     platformControl.PlaceholderText = searchBar.Placeholder ?? string.Empty;
 }
Exemple #10
0
 public static void UpdateMaxLength(this SearchView searchView, ISearchBar searchBar, EditText?editText)
 {
     searchView.UpdateMaxLength(searchBar.MaxLength, editText);
 }
        public static void UpdateIsTextPredictionEnabled(this AutoSuggestBox platformControl, ISearchBar searchBar, MauiSearchTextBox?queryTextBox)
        {
            if (queryTextBox == null)
            {
                return;
            }

            queryTextBox.IsTextPredictionEnabled = searchBar.IsTextPredictionEnabled;
        }
Exemple #12
0
 public static void UpdateMaxLength(this SearchView searchView, ISearchBar searchBar)
 {
     searchView.UpdateMaxLength(searchBar.MaxLength, null);
 }
Exemple #13
0
 public static void UpdateVerticalTextAlignment(this SearchView searchView, ISearchBar searchBar)
 {
     searchView.UpdateVerticalTextAlignment(searchBar, null);
 }
Exemple #14
0
 public static void UpdateFont(this UISearchBar uiSearchBar, ISearchBar searchBar, IFontManager fontManager)
 {
     uiSearchBar.UpdateFont(searchBar, fontManager, null);
 }
 public static void UpdateVerticalTextAlignment(this UISearchBar uiSearchBar, ISearchBar searchBar)
 {
     uiSearchBar.UpdateVerticalTextAlignment(searchBar, null);
 }
        public static void UpdatePlaceholderColor(this AutoSuggestBox platformControl, ISearchBar searchBar, Brush?defaultPlaceholderColorBrush, Brush?defaultPlaceholderColorFocusBrush, MauiSearchTextBox?queryTextBox)
        {
            if (queryTextBox == null)
            {
                return;
            }

            Color placeholderColor = searchBar.PlaceholderColor;

            BrushHelpers.UpdateColor(placeholderColor, ref defaultPlaceholderColorBrush,
                                     () => queryTextBox.PlaceholderForegroundBrush, brush => queryTextBox.PlaceholderForegroundBrush = brush);

            BrushHelpers.UpdateColor(placeholderColor, ref defaultPlaceholderColorFocusBrush,
                                     () => queryTextBox.PlaceholderForegroundFocusBrush, brush => queryTextBox.PlaceholderForegroundFocusBrush = brush);
        }
 public static void UpdateText(this UISearchBar uiSearchBar, ISearchBar searchBar)
 {
     uiSearchBar.Text = searchBar.Text;
 }
 public static void UpdateText(this AutoSuggestBox platformControl, ISearchBar searchBar)
 {
     platformControl.Text = searchBar.Text;
 }
Exemple #19
0
 public static void UpdateIsReadOnly(this UISearchBar uiSearchBar, ISearchBar searchBar)
 {
     uiSearchBar.UserInteractionEnabled = !(searchBar.IsReadOnly || searchBar.InputTransparent);
 }
 public static void UpdateFont(this AutoSuggestBox platformControl, ISearchBar searchBar, IFontManager fontManager) =>
 platformControl.UpdateFont(searchBar.Font, fontManager);
Exemple #21
0
 public static void UpdateIsEnabled(this UISearchBar uiSearchBar, ISearchBar searchBar)
 {
     uiSearchBar.UserInteractionEnabled = searchBar.IsEnabled;
 }
Exemple #22
0
 public static void UpdateCharacterSpacing(this TextView textView, ISearchBar searchBar) =>
 textView.LetterSpacing = searchBar.CharacterSpacing.ToEm();