Skip to content

Commit 4b6e715

Browse files
Update scrolling.md
1 parent fdcb314 commit 4b6e715

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

MAUI/Chat/scrolling.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,6 @@ By default, the [SfChat](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Cha
4949
{% endhighlight %}
5050
{% endtabs %}
5151

52-
## Scrolled event
53-
54-
The [SfChat](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Chat.SfChat.html) control comes with a built-in `Scrolled` event that will be fired whenever the chat control is scrolled. You can get the current scroll offset, whether scrolling has reached the top or bottom of the message list in the [ChatScrolledEventArgs](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Chat.ChatScrolledEventArgs.html). You can handle this event to restrict the auto-scroll in chat for newly added messages, if the user had already scrolled up manually and was currently not at the bottom of the chat when the new message was added.
55-
56-
{% tabs %}
57-
{% highlight xaml hl_lines="4" %}
58-
<sfChat:SfChat x:Name="sfChat"
59-
Messages="{Binding Messages}"
60-
CurrentUser="{Binding CurrentUser}"
61-
Scrolled="sfChat_Scrolled"/>
62-
{% endhighlight %}
63-
{% highlight c# hl_lines="8" %}
64-
sfChat.Scrolled += sfChat_Scrolled;
65-
66-
private void sfChat_Scrolled(object? sender, ChatScrolledEventArgs e)
67-
{
68-
// The chat will not be auto scrolled to the bottom
69-
// if the user is not currently at the bottom end of the chat at the time of the arrival of the new message
70-
// but rather already manually scrolled above to read old messages.
71-
sfChat.CanAutoScrollToBottom = e.IsBottomReached;
72-
}
73-
74-
{% endhighlight %}
75-
{% endtabs %}
76-
7752
## Scroll to bottom button
7853

7954
The `SfChat` control provides the option to display a scroll to bottom button by setting the `ShowScrollToBottomButton` property to `true`. This button appears when scrolled up through older messages and allows quick navigation back to the latest message in the conversation.
@@ -171,3 +146,28 @@ namespace MauiChat
171146

172147
{% endhighlight %}
173148
{% endtabs %}
149+
150+
## Scrolled event
151+
152+
The [SfChat](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Chat.SfChat.html) control comes with a built-in `Scrolled` event that will be fired whenever the chat control is scrolled. You can get the current scroll offset, whether scrolling has reached the top or bottom of the message list in the [ChatScrolledEventArgs](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Chat.ChatScrolledEventArgs.html). You can handle this event to restrict the auto-scroll in chat for newly added messages, if the user had already scrolled up manually and was currently not at the bottom of the chat when the new message was added.
153+
154+
{% tabs %}
155+
{% highlight xaml hl_lines="4" %}
156+
<sfChat:SfChat x:Name="sfChat"
157+
Messages="{Binding Messages}"
158+
CurrentUser="{Binding CurrentUser}"
159+
Scrolled="sfChat_Scrolled"/>
160+
{% endhighlight %}
161+
{% highlight c# hl_lines="8" %}
162+
sfChat.Scrolled += sfChat_Scrolled;
163+
164+
private void sfChat_Scrolled(object? sender, ChatScrolledEventArgs e)
165+
{
166+
// The chat will not be auto scrolled to the bottom
167+
// if the user is not currently at the bottom end of the chat at the time of the arrival of the new message
168+
// but rather already manually scrolled above to read old messages.
169+
sfChat.CanAutoScrollToBottom = e.IsBottomReached;
170+
}
171+
172+
{% endhighlight %}
173+
{% endtabs %}

0 commit comments

Comments
 (0)