Skip to content

Commit 6a2e749

Browse files
Merge pull request #1288 from telerik/development
merge Development into Master
2 parents 2d68d83 + a21c117 commit 6a2e749

File tree

11 files changed

+267
-82
lines changed

11 files changed

+267
-82
lines changed

controls/chat/commands.md

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,82 @@ slug: chat-commands
88

99
# .NET MAUI Chat Commands
1010

11-
The Telerik UI for .NET MAUI Chat allows you to attach commands that will be executed when certain actions such as `SendMessage` occur.
11+
The Telerik UI for .NET MAUI Chat allows you to attach commands that will be executed when certain actions occur.
1212

13-
## Chat Commands
13+
## Commands Related to the Chat Input Area:
1414

15-
Take advantage of the `SendMessageCommand` that is triggered when the send-message button is clicked or when the user presses the `Enter` key on desktop platforms. The command is raised before the Chat auto-creates a `ChatItem` and adds it to the `Items` collection.
15+
* `SendMessageCommand` (`ICommand`)—Defines the command that is executed when the send button is clicked or the `Enter` key is pressed.
16+
* `PickFileCommand` (`ICommand`)—Defines the command that opens the Microsoft.Maui.Storage.FilePicker for attaching files for upload.
17+
* `PickPhotoCommand` (`ICommand`)—Defines the command that opens the Microsoft.Maui.Media.MediaPicker for attaching photos for upload.
18+
* `TakePhotoCommand` (`ICommand`)—Defines the command that opens the camera for attaching a photo.
19+
20+
>tip You need to grand permissions to access the device camera and device external storage.
21+
22+
## Commands Related to Attachments
23+
24+
* `AttachFilesCommand` (`ICommand`)—Defines the command that is executed when the files the end-user picked need to be attached/uploaded.
25+
* `DownloadAttachmentsCommand` (`ICommand`)—Defines the command that is executed when the end user initiates download of attachments for a `Telerik.Maui.Controls.Chat.ChatAttachmentsMessage`. The command parameter of this command is of type `Telerik.Maui.Controls.Chat.ChatDownloadAttachmentsCommandContext.`
26+
* `ShareAttachmentsCommand` (`ICommand`)—Defines the command that triggers the share attachments operation.
27+
* `RemoveAttachedFileCommand` (`ICommand`)—Defines the command that should remove an attached file from the `Telerik.Maui.Controls.RadChat.AttachedFilesSource` collection in the view model.
28+
29+
## Example with SendMessageCommand
1630

1731
Here is an example on how to define a command in the ViewModel and bind the `SendMessageCommand` to it:
1832

19-
**1.** Add the command's `Execute` method.
33+
1. Add the command's `Execute` method.
2034

2135
<snippet id='chat-commands-executemethod' />
2236

23-
**2.** Define the `RadChat` component:
37+
2. Define the `RadChat` component:
2438

2539
<snippet id='chat-commands-xaml' />
2640

27-
**3.** Add the ViewModel:
41+
3. Add the ViewModel:
2842

2943
<snippet id='chat-commands-viewmodel' />
3044

45+
## Example with AttachFilesCommand
46+
47+
1. Define the `RadChat` component:
48+
49+
<snippet id='chat-attachments-xaml' />
50+
51+
2. Add the `ViewModel` with the `AttachFilesCommand` definition:
52+
53+
<snippet id='chat-with-attachments-view-model' />
54+
55+
3. Create a sample `MessageItem` model:
56+
57+
<snippet id='chat-message-item' />
58+
59+
4. Create `AttachmentsItem` class and define the attachments collection property:
60+
61+
<snippet id='chat-attachments-item' />
62+
63+
5. Define an `AttachmentData` class to hold the attachment information:
64+
65+
<snippet id='chat-attachment-data' />
66+
67+
6. Define the custom class for the attachments file data:
68+
69+
<snippet id='chat-attached-file-data' />
70+
71+
7. Define a converter to convert a data item to a chat attachment. In general here you need to create and set up the corresponding `Telerik.Maui.Controls.Chat.ChatAttachedFile` for the given business object:
72+
73+
<snippet id='chat-attached-file-converter' />
74+
75+
8. Define a custom converter that converts from chat specific objects to business objects, so that the `ViewModel` does not have to handle chat specific classes:
76+
77+
<snippet id='chat-attached-file-command-converter' />
78+
79+
9. The `ItemConverter` is need in MVVM scenario as custom items are used:
80+
81+
<snippet id='chat-attachment-item-converter' />
82+
83+
10. The demo uses a custom data file server for uploading, downloading and deleting attachments:
84+
85+
<snippet id='chat-data-server' />
86+
3187
## See Also
3288

3389
- [MVVM Support]({% slug chat-mvvm-support%})

controls/chat/events.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Events
3+
page_title: .NET MAUI Conversational UI Documentation - Events
4+
description: Learn what are the events exposed by the Telerik UI for .NET MAUI Chat
5+
position: 7
6+
slug: chat-events
7+
---
8+
9+
# .NET MAUI Chat Events
10+
11+
The Telerik UI for .NET MAUI Chat allows you to attach events that will be raised when certain actions occur.
12+
13+
Here is a list of the available events:
14+
15+
* `SendMessage`&mdash;Raised when a message is sent from the chat by the current author (by clicking the send message button or pressing Enter).
16+
* `AttachFiles`&mdash;Raised when the end user picks files to attach.
17+
* The `sender` argument, which is of type `object`, but can be cast to the `RadChat` type.
18+
* A `ChatAttachFilesEventArgs` object which provides the list of files (`IList<IFileInfo> FilesToAttach`) to attach to the chat message.
19+
20+
* `RemoveAttachedFile`&mdash;Raised when the end user removes an attached file, via the `X` button of the `ChatInputAreaAttachedFileItemView`.
21+
* The `sender` argument, which is of type `object`, but can be cast to the `RadChat` type.
22+
* * A `ChatRemoveAttachedFileEventArgs` object which provides the index (`Index` of type `int`) of the item that should be removed from the `Telerik.Maui.Controls.RadChat.AttachedFilesSource` and `Telerik.Maui.Controls.RadChat.AttachedFiles`.
23+
24+
## See Also
25+
26+
- [MVVM Support]({% slug chat-mvvm-support%})
27+
- [Chat Items]({%slug chat-items-overview %})

controls/chat/items/overview.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ The `RadChat` control works with a collection of `ChatItem` objects. The control
1212

1313
This section covers the specific details of the different Chat Items provided by `RadChat`:
1414

15-
* [Message]({%slug chat-items-messages %})—The basic message unit in RadChat; apart from the text of the message itself, each `TextMessage` instance contains information about the Author of the message as well as any additional data.
16-
* [Time Break]({%slug chat-items-timebreak %})—Used to encapsulate messages in a conversation by a certain condition such as read/unread, time intervals, or any other condition. It visualizes as a dividing line across the messages board with a text message attached to it.
17-
* [PickerItem]({%slug chat-picker-overview %})—A special `ChatItem` type which contains a `RadChatPicker` control used for providing a selection to the end user. Depending on the information that is presented and the choices the user can make, the pickers can be one of the following types:
15+
* [Message]({%slug chat-items-messages %})&mdash;The basic message unit in RadChat; apart from the text of the message itself, each `TextMessage` instance contains information about the Author of the message as well as any additional data.
16+
* [Attachments]({%slug chat-attachments%})&mdash;The options to attach images, files, and other media to messages in the .NET MAUI Chat.
17+
* [Time Break]({%slug chat-items-timebreak %})&mdash;Used to encapsulate messages in a conversation by a certain condition such as read/unread, time intervals, or any other condition. It visualizes as a dividing line across the messages board with a text message attached to it.
18+
* [PickerItem]({%slug chat-picker-overview %})&mdash;A special `ChatItem` type which contains a `RadChatPicker` control used for providing a selection to the end user. Depending on the information that is presented and the choices the user can make, the pickers can be one of the following types:
1819
* `DatePicker`&mdash;Displays a Calendar to choose a date.
1920
* `TimePicker`&mdash;Displays a clock view to choose a time.
2021
* `ItemPicker`&mdash;Displays a list of suggestions the end user could choose from.

controls/chat/localization.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ In `RadChat`, you can localize the following string:
1717

1818
| Localization Key | Default Value |
1919
| -----------------| ------------- |
20-
| `Chat_EntryPlaceholder` | `Type a message...` |
20+
| `Chat_EntryPlaceholder` | `Type a message...` |
21+
| `Chat_MessageAttachmentAction_Download` | `Download` |
22+
| `Chat_MessageAttachmentAction_Share` | `Share` |
23+
| `Chat_MessageAttachmentsListView_DownloadAll` | `Download All` |
24+
| `Chat_InputArea_PickFile` | `Attach files` |
25+
| `Chat_InputArea_PickPhoto` | `Attach photos` |
26+
| `Chat_InputArea_TakePhoto` | `Take photo` |
2127

2228
The localization key refers to the watermark message that appears in the input field of the Chat.
2329

controls/chat/overview.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ The Telerik UI for .NET MAUI Chat is a UI component that enables the implementat
1515
## Key Features of the .NET MAUI Chat
1616

1717
* [A variety of chat items for great user experience]({%slug chat-items-overview %})&mdash;You can choose between simple text messages, various pickers, such as list view, calendar, date and time pickers, and cards.
18+
* Attachments&mdash;The Chat control allows attaching files to the messages. The supported file types are images, documents, audio and video files. Also you can take photos and attach them to the messages.
19+
* [SpeechToTextButton Integration]({%slug chat-buttons-styling%}#style-the-more-button)&mdash;The Chat control supports speech-to-text functionality, which allows users to dictate their messages instead of typing them.
1820
* [Typing indicator]({%slug chat-typing-indicator%})&mdash;Use the typing indicator to let the users that other Chat participants are currently typing.
1921
* [Template Selectors]({%slug chat-itemtemplate-selector%})&mdash;Apply different templates to each Chat items.
2022
* [Predefined List of Suggestions]({%slug chat-suggested-actions%})&mdash;This feature allows you to have a predefind list of suggestions. So the users of the Chat can choose between predefined items before sending a message.

controls/chat/styling.md

Lines changed: 0 additions & 72 deletions
This file was deleted.

controls/chat/styling/buttons.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: Buttons
3+
page_title: .NET MAUI Chat Documentation - Buttons Styling
4+
description: Learn how to style the buttons inside the Telerik UI for .NET MAUI Chat control.
5+
position: 6
6+
tags: .net maui, telerik .net maui, ui for .net maui, chat, style
7+
slug: chat-buttons-styling
8+
---
9+
10+
# .NET MAUI Chat Buttons Styling
11+
12+
This section describes how to style the send, more and speech to text buttons inside the `RadChat` control.
13+
14+
## Style the Send Button
15+
16+
To customize the icon of the send button, use the `SendMessageButtonImage` (`ImageSource`) property.
17+
18+
The example below shows how to customize the Send button in your Chat control.
19+
20+
```XAML
21+
<FontImageSource x:Key="SendIconSource"
22+
FontFamily="Your font family name"
23+
Glyph="icon code"
24+
Color="Black"
25+
Size="16" />
26+
```
27+
28+
```XAML
29+
<telerik:RadChat x:Name="chat"
30+
SendMessageButtonImage="{StaticResource SendIconSource}"/>
31+
```
32+
33+
## Style the More Button
34+
35+
The More button provides additional options for the user, such as attaching files or accessing other functionalities.
36+
37+
You can configure and style the More button using the following properties:
38+
39+
* `IsMoreButtonVisible` (`bool`) property controls the visibility of the more button. The default value is `false`.
40+
41+
* `AutoGenerateMoreButtonActions `(`bool`)&mdash;Defines whether to automatically generate default actions for the 'More' button. The default value is `true`.
42+
43+
* Define the actions that will appear when the More button is tapped by adding instances of `ChatMoreButtonAction` to the `MoreButtonActions` (`IList<ChatMoreButtonAction>`) collection.
44+
45+
* Style the More button using the `MoreButtonStyle` (`Style` with target type `Telerik.Maui.Controls.Chat.ChatMoreButtonToolbarItemView`) property.
46+
47+
## Style the SpeechToTextButton
48+
49+
To configure the SpeechToTextButton, use the following properties:
50+
51+
* `IsSpeechToTextButtonVisible` (`bool`) property controls the visibility of the SpeechToTextButton. By default, the button is visible on Android, iOS and MacCatalyst and not visible on Windows.
52+
53+
* `SpeechToTextButtonStyle` (`Style` with target type `Telerik.Maui.Controls.RadSpeechToTextButton`) property is used to style the SpeechToTextButton.
54+
55+
## See Also
56+
57+
- [Commands]({%slug chat-commands%})
58+
- [Chat Items]({%slug chat-items-overview%})
59+
- [MVVM Support]({%slug chat-mvvm-support%})

controls/chat/styling/entry.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Input Area
3+
page_title: .NET MAUI Chat Documentation - Input Area Styling
4+
description: Learn how to style the input area of the Telerik UI for .NET MAUI Chat control.
5+
position: 6
6+
tags: .net maui, telerik .net maui, ui for .net maui, chat, style
7+
slug: chat-input-area-styling
8+
---
9+
10+
# .NET MAUI Chat Input Area Styling
11+
12+
The Telerik UI for .NET MAUI Chat control allows you to customize the appearance of its input area, by setting the `InputAreaStyle` (`Style` with target type `Telerik.Maui.Controls.Chat.ChatInputArea`) property.
13+
14+
The available properties for customizing the input area are:
15+
16+
* `BackgroundColor` (`Color`)&mdash;Defines the background color of the input area.
17+
* `BorderColor` (`Color`)&mdash;Defines the border color of the input area.
18+
* `BorderThickness` (`Thickness`)&mdash;Defines the border thickness of the input area.
19+
* `CornerRadius` (`Thickness`)&mdash;Defines the corner radius of the input area.
20+
* `ContentPadding` (`Thickness`)&mdash;Defines the padding inside the input area.
21+
* `AttachedFilesViewStyle` (`Style` with target type `Telerik.Maui.Controls.Chat.ChatInputAreaAttachedFilesView`)&mdash;Defines the style of view of the currently attached files hat have not yet been sent.
22+
23+
## Style the Chat Entry
24+
25+
You can style the `ChatEntry` using an implicit style.
26+
27+
The example below shows how to customize the chat entry in your Chat control. The `Telerik.Maui.Controls.Chat.ChatEntry` represents the entry used for writing messages in the Telerik UI for .NET MAUI Chat control.
28+
29+
```XAML
30+
<Style TargetType="telerik:ChatEntry">
31+
<Setter Property="BorderBrush" Value="{StaticResource ChatInputAreaStrokeColor}" />
32+
<Setter Property="FocusedBorderBrush" Value="{StaticResource ChatInputAreaStrokeColor}" />
33+
<Setter Property="BorderThickness" Value="1" />
34+
<Setter Property="CornerRadius" Value="8" />
35+
</Style>
36+
```
37+
38+
## Customize the Send Button
39+
40+
The Telerik UI for .NET MAUI Chat allows you to customize the icon of the send button by setting the `SendMessageButtonImage` (`ImageSource`) property.
41+
42+
The example below shows how to customize the Send button in your Chat control.
43+
44+
```XAML
45+
<FontImageSource x:Key="SendIconSource"
46+
FontFamily="Your font family name"
47+
Glyph="icon code"
48+
Color="Black"
49+
Size="16" />
50+
```
51+
52+
```XAML
53+
<telerik:RadChat x:Name="chat"
54+
SendMessageButtonImage="{StaticResource SendIconSource}"/>
55+
```
56+
57+
## See Also
58+
59+
- [Commands]({% slug chat-commands %})
60+
- [Chat Items]({%slug chat-items-overview %})
61+
- [MVVM Support]({%slug chat-mvvm-support %})

controls/chat/styling/messages.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Message
3+
page_title: .NET MAUI Chat Documentation - Message Styling
4+
description: Learn how to style the outgoing and incoming messages in the Telerik UI for .NET MAUI Chat control.
5+
position: 6
6+
tags: .net maui, telerik .net maui, ui for .net maui, chat, style
7+
slug: chat-message-styling
8+
---
9+
10+
# .NET MAUI Chat Message Styling
11+
12+
Any change in the appearance of the `RadChat` components depends on the referenced styles. The default templates contain a `RadBorder` control (used to achieve the rounded edges), an Image control (used for the avatar of the single and first message), and a Label for the text message itself.
13+
14+
To customize the different parts of the control, you can use the following built-in styles:
15+
16+
- `MessageImageStyle`(target type `Image`)&mdash;Defines the style referred to the send button image.
17+
18+
- `OutgoingMessageImageStyle` (target type `Image`)&mdash;Defines the style of the outgoing message image.
19+
20+
- `IncomingBorderStyle` (target type `RadBorder`)&mdash;Defines the style of the incoming message border.
21+
22+
- `OutgoingBorderStyle` (target type `RadBorder`)&mdash;Defines the style of the outgoing message border.
23+
24+
- `DefaultLabelStyle` (target type `Label`)&mdash;Defines the default label style.
25+
26+
- `OutgoingLabelStyle` (target type `Label`)&mdash;Defines the style of the label of the outgoing message.
27+
28+
In addition, the following properties set the background of the Chat:
29+
30+
* `BackgroundColor`(`Color`)&mdash;Defines the background color of the Chat control.
31+
* `InputAreaBackgroundColor`(`Color`)&mdash;Defines the background color of the area that the input elements (entry and button) reside.
32+
33+
## See Also
34+
35+
- [Commands]({% slug chat-commands %})
36+
- [Chat Items]({%slug chat-items-overview %})
37+
- [MVVM Support]({%slug chat-mvvm-support %})
File renamed without changes.

0 commit comments

Comments
 (0)