コード例 #1
0
ファイル: SearchBarExtensions.cs プロジェクト: sung-su/maui
        public static void UpdateMaxLength(this AutoSuggestBox platformControl, ISearchBar searchBar)
        {
            var maxLength = searchBar.MaxLength;

            if (maxLength == -1)
            {
                maxLength = int.MaxValue;
            }

            if (maxLength == 0)
            {
                MauiAutoSuggestBox.SetIsReadOnly(platformControl, true);
            }
            else
            {
                MauiAutoSuggestBox.SetIsReadOnly(platformControl, searchBar.IsReadOnly);
            }

            var currentControlText = platformControl.Text;

            if (currentControlText.Length > maxLength)
            {
                platformControl.Text = currentControlText.Substring(0, maxLength);
            }
        }
コード例 #2
0
ファイル: SearchBarExtensions.cs プロジェクト: sung-su/maui
 public static void UpdateIsReadOnly(this AutoSuggestBox platformControl, ISearchBar searchBar)
 {
     MauiAutoSuggestBox.SetIsReadOnly(platformControl, searchBar.IsReadOnly);
 }