Class CalendarMessage
Represents a class which contains the functionalities for the calendar message in SfChat.
Inherited Members
Namespace: Syncfusion.XForms.Chat
Assembly: Syncfusion.SfChat.XForms.dll
Syntax
public class CalendarMessage : TextMessage, ICalendarMessage, ITextMessage, IMessage
Examples
The following code example demonstrates how to add calendar message in SfChat control.
using Syncfusion.XForms.Chat;
using Xamarin.Forms;
namespace ChatDemo
{
public class SfChatDemo : ContentPage
{
SfChat sfChat;
public SfChatDemo()
{
sfChat = new SfChat();
viewModel = new GettingStartedViewModel();
sfChat.CurrentUser = viewModel.CurrentUser;
CalendarMessage message = new CalendarMessage();
message.Author = new Author() { Name = "Nancy", Avatar ="Nancy.png" };
message.SelectedDate = DateTime.Now;
message.DisplayMode = ViewMode.MonthView;
viewModel.Messages.Add(message);
sfChat.Messages = viewModel.Messages;
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:CalendarMessage
SelectedDate="{Binding Date,Source={x:Reference viewModel}}"
Author = "{Binding IncomingMessageAuthor,Source={x:Reference viewModel}}"
DisplayMode="MonthView">
</sfchat:CalendarMessage>
</sfchat:SfChat.Messages>
</sfchat:SfChat>
</ContentPage.Content>
</ContentPage>
Constructors
CalendarMessage()
Declaration
public CalendarMessage()
Fields
DisplayModeProperty
Identifies the DisplayMode Xamarin.Forms.BindableProperty.
Declaration
public static readonly BindableProperty DisplayModeProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectedDateProperty
Identifies the SelectedDate Xamarin.Forms.BindableProperty.
Declaration
public static readonly BindableProperty SelectedDateProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
Properties
DisplayMode
Gets or sets the display mode for the calendar message.
Declaration
public ViewMode DisplayMode { get; set; }
Property Value
Type | Description |
---|---|
ViewMode | The display mode of the calendar. The default mode is month. |
SelectedDate
Gets or sets the date selected by the user.
Declaration
public DateTime SelectedDate { get; set; }
Property Value
Type |
---|
System.DateTime |