Gnana
Gnana

Reputation: 1

In MAUI[Android], Scrollview doesn't work inside maui.community.toolkit.popup

I have tried the same layout in content page, it works. Its not working only in popup.

Below is my XAML code structure.

<toolkit:Popup
    x:Class="MuniLogicMobile.View.ReportsPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml
    xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
    x:Name="popup"
    Color="Transparent">

    <Border
        Grid.Column="1"
        Stroke="{x:StaticResource Secondary}"
        StrokeThickness="2">
        <Border.StrokeShape>
            <RoundRectangle CornerRadius="10" />
        </Border.StrokeShape>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
           
            <ScrollView
                Margin="10"
                HeightRequest="500"
                VerticalOptions="FillAndExpand">
                <VerticalStackLayout
                    Margin="10">
                </VerticalStackLayout>
            </ScrollView>
        </Grid>
    </Border>
</toolkit:Popup>

just add above layout and try it in your popup. Add more items inside VerticalStackLayout.

I'm facing this issue in Android platform, haven't tried in iOS.

Tried to set Height for scrollview, and set HosrizontalOptions & VerticalOptions as Fill

Both of them separately as well together doesn't work.

Upvotes: 0

Views: 613

Answers (1)

Jessie Zhang -MSFT
Jessie Zhang -MSFT

Reputation: 13889

I did a test on my side, but I couldn't reproduce this problem. I just added two Labels inside of the inner VerticalStackLayout. I tested on android emulator(Pixel 5-Api 3).

Please refer to the following code I used, which could work properly on my side.

  <?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
             x:Class="PopUpMauiApp.MyPopPage"
            >
    <Border
        Grid.Column="1"
        Stroke="#C49B33"
        StrokeThickness="2">
        <Border.StrokeShape>
            <RoundRectangle CornerRadius="10" />
        </Border.StrokeShape>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <ScrollView
                Margin="10"
                HeightRequest="500"
                VerticalOptions="FillAndExpand">
                <VerticalStackLayout
                    Margin="10">

                    <Label TextColor="Red" Text="1 FOR the most wild, yet most homely narrative which I am about to pen, I neither expect nor solicit belief. Mad indeed would I be to expect it, in a case where my very senses reject their own evidence. Yet, mad am I not -- and very surely do I not dream. But to-morrow I die, and to-day I would unburthen my soul. My immediate purpose is to place before the world, plainly, succinctly, and without comment, a series of mere household events. In their consequences, these events have terrified -- have tortured -- have destroyed me. Yet I will not attempt to expound them. To me, they have presented little but Horror -- to many they will seem less terrible than barroques. Hereafter, perhaps, some intellect may be found which will reduce my phantasm to the common-place -- some intellect more calm, more logical, and far less excitable than my own, which will perceive, in the circumstances I detail with awe, nothing more than an ordinary succession of very natural causes and effects." />
                    <Label TextColor="Green" Text="2 FOR the most wild, yet most homely narrative which I am about to pen, I neither expect nor solicit belief. Mad indeed would I be to expect it, in a case where my very senses reject their own evidence. Yet, mad am I not -- and very surely do I not dream. But to-morrow I die, and to-day I would unburthen my soul. My immediate purpose is to place before the world, plainly, succinctly, and without comment, a series of mere household events. In their consequences, these events have terrified -- have tortured -- have destroyed me. Yet I will not attempt to expound them. To me, they have presented little but Horror -- to many they will seem less terrible than barroques. Hereafter, perhaps, some intellect may be found which will reduce my phantasm to the common-place -- some intellect more calm, more logical, and far less excitable than my own, which will perceive, in the circumstances I detail with awe, nothing more than an ordinary succession of very natural causes and effects." />

                </VerticalStackLayout>
            </ScrollView>
                
        </Grid>
    </Border>
</toolkit:Popup>

Note:

Please make sure to use the latest version for your nuget.

Upvotes: 0

Related Questions