You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MAUI/Chat/messages.md
+212Lines changed: 212 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1314,8 +1314,218 @@ We have loaded a custom template if the message's text contains a particular tex
1314
1314
1315
1315

1316
1316
1317
+
### Template Selector to return base template
1318
+
1319
+
Create a custom class that inherits from `ChatMessageTemplateSelector`, and override the OnSelectTemplate method to return the base template for that item.
if ((item as ITextMessage)!.Text == "Hi guys, good morning! I'm very delighted to share with you the news that our team is going to launch a new mobile application.")
1345
+
{
1346
+
return customOutgoingMessageTemplate;
1347
+
}
1348
+
else if ((item as ITextMessage)!.Text == "Oh! That's great.")
1349
+
{
1350
+
return customIncomingMessageTemplate;
1351
+
}
1352
+
else
1353
+
{
1354
+
return base.OnSelectTemplate(item, container);
1355
+
}
1356
+
}
1357
+
else
1358
+
{
1359
+
return null;
1360
+
}
1361
+
}
1362
+
}
1363
+
}
1364
+
1365
+
{% endhighlight %}
1366
+
{% endtabs %}
1367
+
1317
1368
N> [View sample in GitHub](https://github.com/SyncfusionExamples/message-template-.net-maui-chat)
1318
1369
1370
+
## Targetable Views
1371
+
1372
+
The `SfChat` allows you to target and fully customize views within the chat control. The following views can be targeted and customized:
1373
+
-`IncomingMessageContentView` - Represents the incoming content view of the messages.
1374
+
-`IncomingMessageAuthorView` - Represents incoming message author name area.
`SfChat` allows to change the vertical spacing between the messages in view using [MessageSpacing](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Chat.SfChat.html#Syncfusion_Maui_Chat_SfChat_MessageSpacing) property. The default value is `8`.
@@ -1601,6 +1811,8 @@ By default, the author’s name and avatar are displayed for the incoming messag
1601
1811
1602
1812

1603
1813
1814
+
N> In `SfChat`, when only the author's name is provided and no avatar image is set, the control automatically displays the author's initials.
1815
+
1604
1816
## MessageTimestampFormat for incoming and outgoing messages
1605
1817
1606
1818
The `SfChat` allows you specify the format in which timestamps are shown for outgoing and incoming messages. The date and time representation can be customized using the [IncomingMessageTimestampFormat](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Chat.SfChat.html#Syncfusion_Maui_Chat_SfChat_IncomingMessageTimestampFormat) and [OutgoingMessageTimestampFormat](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Chat.SfChat.html#Syncfusion_Maui_Chat_SfChat_OutgoingMessageTimestampFormat) properties.
0 commit comments