Hi.
I am new to .NET MAUI and XAML.
I have a scroll view inside a ContentPage and inside the scroll view I have a Vertical Stack Layout with 2 items, a label and a button.
When the button is clicked, I add labels to the stack dynamically.
What I expect to happen is when the content size of the StackLayout is bigger than the size of the ScrollView, the scrollbar appear and I can scroll the view.
However it is not happening. I need to resize the window at least a few pixels in order to get the scrollbar appear and able to scroll the view.
I have tried to set ScrollbarVisibility to "Always" and Position to "FillAndExpand" but did not make any difference.
Would anyone have any idea why the view doesn't scroll once the item list inside the scroll view is bigger than the window?
Any help is appreciated.
Using:
macOS 13.1
Visual Studio 2022 for Mac
.NET 7
Target platform: Mac(MacCatalyst)
Thank you.
I am new to .NET MAUI and XAML.
I have a scroll view inside a ContentPage and inside the scroll view I have a Vertical Stack Layout with 2 items, a label and a button.
XML:
<ScrollView>
<VerticalStackLayout
x:Name="Stack"
Spacing="25"
Padding="30,0"
VerticalOptions="Center">
<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
<Button
x:Name="ThirdButton"
Text="Create Label"
Clicked="OnCreateClicked"
HorizontalOptions="Start" />
</VerticalStackLayout>
</ScrollView>
When the button is clicked, I add labels to the stack dynamically.
C#:
private void OnCreateClicked(object sender, EventArgs e)
{
Label label = new Label { Text = "This is a new label" };
Stack.Add(label);
}
What I expect to happen is when the content size of the StackLayout is bigger than the size of the ScrollView, the scrollbar appear and I can scroll the view.
However it is not happening. I need to resize the window at least a few pixels in order to get the scrollbar appear and able to scroll the view.
I have tried to set ScrollbarVisibility to "Always" and Position to "FillAndExpand" but did not make any difference.
Would anyone have any idea why the view doesn't scroll once the item list inside the scroll view is bigger than the window?
Any help is appreciated.
Using:
macOS 13.1
Visual Studio 2022 for Mac
.NET 7
Target platform: Mac(MacCatalyst)
Thank you.