menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TextMessage - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class TextMessage

    Represents a class which contains the functionalities for the simple string type of message in SfChat.

    Inheritance
    System.Object
    MessageBase
    TextMessage
    CalendarMessage
    CardMessage
    DatePickerMessage
    HyperlinkMessage
    ImageMessage
    TimePickerMessage
    Implements
    ITextMessage
    IMessage
    Inherited Members
    MessageBase.Author
    MessageBase.AuthorProperty
    MessageBase.Data
    MessageBase.DataProperty
    MessageBase.DateTime
    MessageBase.DateTimeProperty
    MessageBase.Dispose()
    MessageBase.HideAfterSelection
    MessageBase.HideAfterSelectionProperty
    MessageBase.IsMessageContentHiddenAfterSelection
    MessageBase.IsSuggestionViewHiddenAfterSelection
    MessageBase.Suggestions
    MessageBase.SuggestionsProperty
    Namespace: Syncfusion.XForms.Chat
    Assembly: Syncfusion.SfChat.XForms.dll
    Syntax
    public class TextMessage : MessageBase, ITextMessage, IMessage
    Examples

    The following code example demonstrates how to add text message in SfChat control.

    using Syncfusion.XForms.Chat;
    using Xamarin.Forms;
    

    namespace ChatDemo { public class SfChatDemo : ContentPage { SfChat sfChat;

        public SfChatDemo()
        {
            sfChat = new SfChat();
    
            TextMessage message = new TextMessage();
            message.Text = "HI";
            message.Author = new Author() { Name = "Andrea", Avatar = "Andrea.png" };
            sfChat.Messages.Add(message);
    
            this.Content = sfChat;
        }
    }
    

    }

    <? xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns = "http://xamarin.com/schemas/2014/forms"
                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                xmlns:d="http://xamarin.com/schemas/2014/forms/design"
                xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                xmlns:sfchat="clr-namespace:Syncfusion.XForms.Chat;assembly=Syncfusion.SfChat.XForms"
                xmlns:local="clr-namespace:Chat"
                mc:Ignorable="d"
                x:Class="Chat.SfChatDemo">
       <ContentPage.BindingContext>
           <local:ViewModel x:Name="viewModel"/>
       </ContentPage.BindingContext>
       <ContentPage.Content>
           <sfchat:SfChat x:Name="Sfchat">
               <sfchat:SfChat.Messages>
                   <sfchat:TextMessage
                           Author="{Binding IncomingMessageAuthor,Source={x:Reference viewModel}}"
                           Text = "HI" >
                   </sfchat:TextMessage>
               </sfchat:SfChat.Messages>
           </sfchat:SfChat>
       </ContentPage.Content>
    </ContentPage>

    Constructors

    TextMessage()

    Declaration
    public TextMessage()

    Fields

    TextProperty

    Identifies the Text Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty TextProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty

    Properties

    Text

    Gets or sets the text to be display as the message.

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

    Implements

    ITextMessage
    IMessage
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved