alexa
menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download

    Show / Hide Table of Contents

    Class SfSmartTextEditor

    Initializes a new instance of the SfSmartTextEditor class that represents a control, used to providing auto-suggestions for text input.

    Inheritance
    System.Object
    SfView
    SfSmartTextEditor
    Implements
    IDrawableLayout
    Microsoft.Maui.Graphics.IDrawable
    Microsoft.Maui.IAbsoluteLayout
    Microsoft.Maui.ILayout
    Microsoft.Maui.IView
    Microsoft.Maui.IElement
    Microsoft.Maui.ITransform
    Microsoft.Maui.IContainer
    System.Collections.Generic.IList<Microsoft.Maui.IView>
    System.Collections.Generic.ICollection<Microsoft.Maui.IView>
    System.Collections.Generic.IEnumerable<Microsoft.Maui.IView>
    System.Collections.IEnumerable
    Microsoft.Maui.ISafeAreaView
    Microsoft.Maui.IPadding
    Microsoft.Maui.ICrossPlatformLayout
    Microsoft.Maui.IVisualTreeElement
    Inherited Members
    SfView.ArrangeContent(Rect)
    SfView.ArrangeOverride(Rect)
    SfView.Children
    SfView.ClipToBounds
    SfView.GetSemanticsNodesCore(Double, Double)
    SfView.IDrawableLayout.DrawingOrder
    SfView.IDrawableLayout.InvalidateDrawable()
    SfView.MeasureContent(Double, Double)
    SfView.MeasureOverride(Double, Double)
    SfView.OnBindingContextChanged()
    SfView.OnDraw(ICanvas, RectF)
    SfView.Padding
    SfView.PaddingProperty
    Namespace: Syncfusion.Maui.SmartComponents
    Assembly: Syncfusion.Maui.SmartComponents.dll
    Syntax
    public class SfSmartTextEditor : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, IKeyboardListener, IParentThemeElement, IThemeElement

    Constructors

    SfSmartTextEditor()

    Initializes a new instance of the SfSmartTextEditor class.

    Declaration
    public SfSmartTextEditor()

    Fields

    MaxLengthProperty

    Identifies the MaxLength dependency property.

    Declaration
    public static readonly BindableProperty MaxLengthProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for MaxLength dependency property.

    PlaceholderColorProperty

    Identifies the PlaceholderColor dependency property.

    Declaration
    public static readonly BindableProperty PlaceholderColorProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for PlaceholderColor dependency property.

    PlaceholderProperty

    Identifies the Placeholder dependency property.

    Declaration
    public static readonly BindableProperty PlaceholderProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Placeholder dependency property.

    SuggestionDisplayModeProperty

    Identifies the SuggestionDisplayMode dependency property.

    Declaration
    public static readonly BindableProperty SuggestionDisplayModeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for SuggestionDisplayMode dependency property.

    SuggestionPopupBackgroundProperty

    Identifies the SuggestionPopupBackground dependency property.

    Declaration
    public static readonly BindableProperty SuggestionPopupBackgroundProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for SuggestionPopupBackground dependency property.

    SuggestionTextColorProperty

    Identifies the SuggestionTextColor dependency property.

    Declaration
    public static readonly BindableProperty SuggestionTextColorProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for SuggestionTextColor dependency property.

    TextChangedCommandProperty

    Identifies the TextChangedCommand dependency property.

    Declaration
    public static readonly BindableProperty TextChangedCommandProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for TextChangedCommand dependency property.

    TextProperty

    Identifies the Text dependency property.

    Declaration
    public static readonly BindableProperty TextProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Text dependency property.

    TextStyleProperty

    Identifies the TextStyle dependency property.

    Declaration
    public static readonly BindableProperty TextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for TextStyle dependency property.

    UserPhrasesProperty

    Identifies the UserPhrases dependency property.

    Declaration
    public static readonly BindableProperty UserPhrasesProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for UserPhrases dependency property.

    UserRoleProperty

    Identifies the UserRole dependency property.

    Declaration
    public static readonly BindableProperty UserRoleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for UserRole dependency property.

    Properties

    MaxLength

    Gets or sets the maximum number of characters in the text editor.

    Declaration
    public int MaxLength { get; set; }
    Property Value
    Type Description
    System.Int32

    The default value of MaxLength is int.MaxValue.

    Examples

    The following code demonstrates, how to use the MaxLength property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste"
                        MaxLength="200"/>
    ste.MaxLength = 200;

    Placeholder

    Gets or sets the placeholder text displayed when the control is empty.

    Declaration
    public string Placeholder { get; set; }
    Property Value
    Type Description
    System.String

    The default value of Placeholder is string.Empty.

    Examples

    The following code demonstrates, how to use the Placeholder property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste"
                        Placeholder="Type your message here..."/>
    ste.Placeholder = "Type your message here...";

    PlaceholderColor

    Gets or sets the color of the placeholder text.

    Declaration
    public Color PlaceholderColor { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Graphics.Color

    The default value of PlaceholderColor is Color.FromArgb("#49454F").

    Examples

    The following code demonstrates, how to use the PlaceholderColor property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste"
                    PlaceholderColor="Blue"/>
    ste.PlaceholderColor = Colors.Blue;

    SuggestionDisplayMode

    Gets or sets to indicate whether suggestions should be displayed in an inline or popup.

    Declaration
    public SuggestionDisplayMode SuggestionDisplayMode { get; set; }
    Property Value
    Type Description
    SuggestionDisplayMode

    The default value of SuggestionDisplayMode is dependent on platform. For, Window and Mac catalyst is Inline, and Android and IOS is Popup.

    Remarks

    In android and ios, for inline suggestion mode is not supported to apply suggestion on pressing the tab key.

    Examples

    The following code demonstrates, how to use the SuggestionDisplayMode property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste"
                      SuggestionDisplayMode="Popup"/>
    ste.SuggestionDisplayMode = SuggestionDisplayMode.Popup;

    SuggestionPopupBackground

    Gets or sets the background for suggestion popup.

    Declaration
    public Brush SuggestionPopupBackground { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    The default value of SuggestionPopupBackground is SolidColorBrush(Color.FromArgb("#F7F2FB")).

    Examples

    The following code demonstrates, how to use the SuggestionPopupBackground property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste"
                    SuggestionPopupBackground="LightBlue"/>
    ste.SuggestionPopupBackground = Colors.LightBlue;

    SuggestionTextColor

    Gets or sets the color of suggestion text.

    Declaration
    public Color SuggestionTextColor { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Graphics.Color

    The default value of SuggestionTextColor is Color.FromArgb("#611c1b1f").

    Examples

    The following code demonstrates, how to use the SuggestionTextColor property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste"
                    SuggestionTextColor="Gray"/>
    ste.SuggestionTextColor = Colors.Gray;

    Text

    Gets or sets the text content of the smart text editor.

    Declaration
    public string Text { get; set; }
    Property Value
    Type Description
    System.String

    The default value of Text is string.Empty.

    Examples

    The following code demonstrates, how to use the Text property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste"
                      Text="Thank you for contacting us."/>
    ste.Text = "Thank you for contacting us.";

    TextChangedCommand

    Gets or sets the smart text editor text changed command.

    Declaration
    public ICommand TextChangedCommand { get; set; }
    Property Value
    Type Description
    System.Windows.Input.ICommand

    The default value of TextChangedCommand is null.

    Examples

    The following code demonstrates, how to use the TextChangedCommand property in the smart text editor.

    • XAML
    • C#
     <ContentPage.BindingContext>
       <local:ViewModel/>
     </ContentPage.BindingContext>
    <ste:SfSmartTextEditor x:Name="ste"
                         TextChangedCommand="{Binding TextCommand}">
    </ste:SfSmartTextEditor>
    public class ViewModel : INotifyPropertyChanged
    {
        private Command textCommand;
        public ICommand TextCommand
        {
            get
            {
                return textCommand;
            }
            set
            {
                if (textCommand != value)
                {
                    textCommand = value;
                    OnPropertyChanged(nameof(TextCommand));
                }
            }
        }
        public ViewModel()
        {
            TextCommand = new Command(TextChanged);
        }
        private void TextChanged()
        {
        }
    }

    TextStyle

    Gets or sets the style applied to the input text.

    Declaration
    public SmartTextEditorStyle TextStyle { get; set; }
    Property Value
    Type Description
    SmartTextEditorStyle

    The default value of TextStyle is a new instance of SmartTextEditorStyle.

    Examples

    The following code demonstrates, how to use the TextStyle property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste">
        <ste:SfSmartTextEditor.TextStyle>
            <ste:SmartTextEditorStyle FontSize="16" TextColor="DarkBlue"/>
        </ste:SfSmartTextEditor.TextStyle>
    </ste:SfSmartTextEditor>
    ste.TextStyle = new SmartTextEditorStyle()
    {
        TextColor = Colors.DarkBlue,
        FontSize = 16
    };

    UserPhrases

    Gets or sets the collection of user-defined custom phrases.

    Declaration
    public List<string> UserPhrases { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    The default value of UserPhrases is null.

    Examples

    The following code demonstrates, how to use the UserPhrases property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste"/>
    ste.UserPhrases = new List<string>()
    {
       "Thank you for contacting us.",
       "To investigate, We will need a reproducible example as a public Git repository.",
       "Bug report: File not found error occurred in NEED_INFO."
    };

    UserRole

    Gets or sets the role of the user interacting with the control.

    Declaration
    public string UserRole { get; set; }
    Property Value
    Type Description
    System.String

    The default value of UserRole is null.

    Examples

    The following code demonstrates, how to use the UserRole property in the smart text editor.

    • XAML
    • C#
    <ste:SfSmartTextEditor x:Name="ste"
                         UserRole="Maintainer of an open-source project replying to GitHub issues">
    </ste:SfSmartTextEditor>
    ste.UserRole = "Maintainer of an open-source project replying to GitHub issues";

    Methods

    OnHandlerChanged()

    Method invokes when handler changed.

    Declaration
    protected override void OnHandlerChanged()
    Overrides
    SfView.OnHandlerChanged()

    Events

    TextChanged

    Event occurs when the text is changed.

    Declaration
    public event EventHandler<TextChangedEventArgs> TextChanged
    Event Type
    Type
    System.EventHandler<TextChangedEventArgs>

    Implements

    IDrawableLayout
    Microsoft.Maui.Graphics.IDrawable
    Microsoft.Maui.IAbsoluteLayout
    Microsoft.Maui.ILayout
    Microsoft.Maui.IView
    Microsoft.Maui.IElement
    Microsoft.Maui.ITransform
    Microsoft.Maui.IContainer
    System.Collections.Generic.IList<>
    System.Collections.Generic.ICollection<>
    System.Collections.Generic.IEnumerable<>
    System.Collections.IEnumerable
    Microsoft.Maui.ISafeAreaView
    Microsoft.Maui.IPadding
    Microsoft.Maui.ICrossPlatformLayout
    Microsoft.Maui.IVisualTreeElement
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved