Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maui ScrollView - Scrollbar length not updating when content dynamically changed

Tags:

c#

maui

I tried this content with TwoWay mode.
I used ObservableCollection, when I modify the content is updated, but the scroll length is not updated.

![scrollview content is too long

Right Scrollbar is too long.
How can I update the scrollbar length?

<ScrollView BackgroundColor="LightGray" x:Name="InfoStack">
        <StackLayout
            BindableLayout.ItemsSource="{Binding Source={x:Static local:InfoHelpers.Ints}, Mode=TwoWay}">
            <BindableLayout.ItemTemplate>
                <DataTemplate>
                    <.../>
                </DataTemplate>
            </BindableLayout.ItemTemplate>
        </StackLayout>
    </ScrollView>
like image 569
hyuckkim Avatar asked Sep 18 '25 08:09

hyuckkim


1 Answers

After changing content, this might fix it:

(InfoStack as IView).InvalidateArrange();

UPDATE BASED ON COMMENT

Instead use:

(InfoStack as IView).InvalidateMeasure();
like image 92
ToolmakerSteve Avatar answered Sep 19 '25 20:09

ToolmakerSteve