Esempio n. 1
0
 public static void UpdateFont(this MauiTextBox nativeControl, Font font, IFontManager fontManager)
 {
     nativeControl.FontSize   = fontManager.GetFontSize(font);
     nativeControl.FontFamily = fontManager.GetFontFamily(font);
     nativeControl.FontStyle  = font.ToFontStyle();
     nativeControl.FontWeight = font.ToFontWeight();
 }
Esempio n. 2
0
        public static void UpdateMaxLength(this MauiTextBox textBox, IEditor editor)
        {
            textBox.MaxLength = editor.MaxLength;

            var currentControlText = textBox.Text;

            if (currentControlText.Length > editor.MaxLength)
            {
                textBox.Text = currentControlText.Substring(0, editor.MaxLength);
            }
        }
Esempio n. 3
0
        public static void UpdateTextColor(this MauiTextBox textBox, ITextStyle textStyle)
        {
            if (textStyle.TextColor == null)
            {
                return;
            }

            var brush = textStyle.TextColor.ToNative();

            textBox.Foreground           = brush;
            textBox.ForegroundFocusBrush = brush;
        }
Esempio n. 4
0
        public static void UpdateText(this MauiTextBox nativeControl, IEditor editor)
        {
            string newText = editor.Text;

            if (nativeControl.Text == newText)
            {
                return;
            }

            nativeControl.Text = newText;

            if (!string.IsNullOrEmpty(nativeControl.Text))
            {
                nativeControl.SelectionStart = nativeControl.Text.Length;
            }
        }
Esempio n. 5
0
        public static void UpdateMaxLength(this MauiTextBox textBox, IEntry entry)
        {
            var maxLength = entry.MaxLength;

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

            textBox.MaxLength = maxLength;

            var currentControlText = textBox.Text;

            if (currentControlText.Length > maxLength)
            {
                textBox.Text = currentControlText.Substring(0, maxLength);
            }
        }
Esempio n. 6
0
 void OnNativeLoaded(object sender, RoutedEventArgs e) =>
 MauiTextBox.InvalidateAttachedProperties(NativeView);
Esempio n. 7
0
 public static void UpdateIsReadOnly(this MauiTextBox textBox, IEntry entry)
 {
     textBox.IsReadOnly = entry.IsReadOnly;
 }
Esempio n. 8
0
 public static void UpdateIsReadOnly(this MauiTextBox textBox, IEditor editor)
 {
     textBox.IsReadOnly = editor.IsReadOnly;
 }
Esempio n. 9
0
 public static void UpdateFont(this MauiTextBox nativeControl, IText text, IFontManager fontManager) =>
 nativeControl.UpdateFont(text.Font, fontManager);
Esempio n. 10
0
 public static void UpdatePlaceholder(this MauiTextBox textBox, IEntry entry)
 {
     textBox.PlaceholderText = entry.Placeholder ?? string.Empty;
 }
Esempio n. 11
0
 public static void UpdatePlaceholder(this MauiTextBox textBox, IEditor editor)
 {
     textBox.PlaceholderText = editor.Placeholder ?? string.Empty;
 }
Esempio n. 12
0
 public static void UpdateText(this MauiTextBox textBox, IEntry entry)
 {
     textBox.Text = entry.Text;
 }
Esempio n. 13
0
 void OnPlatformLoaded(object sender, RoutedEventArgs e) =>
 MauiTextBox.InvalidateAttachedProperties(PlatformView);