框架大小不适用?- XAML MAUI

o0lyfsai  于 2022-12-07  发布在  其他
关注(0)|答案(1)|浏览(118)
    • 我尝试将框架制作成特定大小,但框架似乎只与框架内的元件大小相符。**

我试着寻找解决方案,但什么也找不到,也许我在寻找错误的东西。

  • XAML:*
<ScrollView>
        <VerticalStackLayout
            Spacing="25"
            Padding="30,0"
            VerticalOptions="Center">

            <Frame BackgroundColor="#303030"
                   Padding="8" CornerRadius="5"
                   HeightRequest="500" WidthRequest="500">

                <StackLayout Spacing="10">
                    <Label Text="Login" FontSize="Medium" FontAttributes="Bold" />
                    <BoxView Color="{DynamicResource Primary}" HeightRequest="2" HorizontalOptions="Fill" />

                    <Entry Placeholder="Username" />
                    <Entry Placeholder="Password" IsPassword="True" />

                    <Button Text="Login" BackgroundColor="{DynamicResource Primary}" TextColor="{DynamicResource White}" />
                </StackLayout>
            </Frame>
        </VerticalStackLayout>
    </ScrollView>
  • 外观:*

  • 我希望它看起来像:*

hfsqlsce

hfsqlsce1#

如果您也有此"问题",请查看toolmakersteve的回复!

  • 密码:*
<ScrollView>
    <VerticalStackLayout
            Spacing="25"
            Padding="30,0"
            VerticalOptions="Center"
            WidthRequest="400"
            HeightRequest="400">
        <Border BackgroundColor="#303030"
                   Padding="8">
            <StackLayout Spacing="10">
                <Label Text="Login" FontSize="Medium" FontAttributes="Bold" />
                <BoxView Color="{DynamicResource Primary}" HeightRequest="2" HorizontalOptions="Fill" />
                <Entry Placeholder="Username" />
                <Entry Placeholder="Password" IsPassword="True" />
                <Button Text="Login" BackgroundColor="{DynamicResource Primary}" TextColor="{DynamicResource White}" Clicked="LoginClick" />
            </StackLayout>
        </Border>
    </VerticalStackLayout>
</ScrollView>
  • 结果:*

相关问题