locked
ContentPage Frame HeightRequest not setting RRS feed

  • Question

  • User228975 posted

    I am on Xamarin Forms 3.3 deploying to Android 5.0 API 21 and it seems that I cannot set the HeightRequest of the Frame on the content page. I have changed the Frame to StackLayout (this gives me a shorter layout but still no able to set the heightrequest). Where is my mistake? Thank you.

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 x:Class="MyApp.View.RegistrationPageFour"
                 x:Name="Page4ContentPage" >
    
    
        <NavigationPage.TitleView>
            <StackLayout Orientation="Horizontal" 
                         VerticalOptions="Center" Spacing="10" >
                <Label Text="Password"  TextColor="White" FontSize="24"  VerticalTextAlignment="Center" />
            </StackLayout>
        </NavigationPage.TitleView> 
    
    
            <Frame x:Name="Page4Frame" Padding="0,0,0,0"  HeightRequest="400">
                <FlexLayout x:Name="Page4FlexLayout" Direction="Column" AlignItems="Center" JustifyContent="SpaceEvenly" >
                    <StackLayout Padding="10,20,10,50" >
                        <Label Text="Please key a secure password" FontSize="24"/>
                    </StackLayout>
    
                    <StackLayout Padding="10,0,10,20" Spacing="15" >
                        <Entry x:Name="Password" Focused="OnPasswordFocused" FontSize="Large" Placeholder="Password" IsPassword="True" MaxLength="64"/>
                        <Entry x:Name="Password2" FontSize="Large" Placeholder="Repeat Password" IsPassword="True" MaxLength="64" />
                    </StackLayout>
                    <StackLayout>
                    <Button Text="Done"  x:Name="Page4Done" 
                            WidthRequest="120"  BorderRadius="60" VerticalOptions="Center" 
                            StyleClass="primary" HorizontalOptions="Center"
                            Clicked="OnButtonClicked" />
                    </StackLayout>
            </FlexLayout>
            </Frame>
    
    </ContentPage>
    
    Friday, October 19, 2018 3:32 AM

Answers

  • User364855 posted

    @AlbertK

    why should I have to frame the "Frame" tag with a StackLayout tag? HeightRequest need some conditions to make it take effect. For example you could set a parent to it. Please check the following links: https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.visualelement.heightrequest?view=xamarin-forms https://stackoverflow.com/questions/35849565/understanding-widthrequest

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, October 22, 2018 7:02 AM

All replies

  • User364855 posted

    @AlbertK

    Please try to wrap Frame with a StackLayout.

    For example:

    <StackLayout>
        <Frame x:Name="Page4Frame" Padding="0,0,0,0"  HeightRequest="400" WidthRequest="200" BackgroundColor="AliceBlue">
             ......
        </Frame>
    </StackLayout>
    
    Monday, October 22, 2018 6:11 AM
  • User228975 posted

    @BillyLiu, Is there a rule as to what must be the first element tag type ? Thank you.

    Monday, October 22, 2018 6:29 AM
  • User364855 posted

    @AlbertK

    Is there a rule as to what must be the first element tag type ? I do not quite understand what you mean. Do you mean each page must have a layout element? No. Using layout could help you to design your page more convenient.

    Monday, October 22, 2018 6:35 AM
  • User228975 posted

    @BillyLiu , My Question is why should I have to frame the "Frame" tag with a StackLayout tag? I have tried replace the Frame tag with Stacklayout tag and that also does not work.

    Monday, October 22, 2018 6:40 AM
  • User364855 posted

    @AlbertK

    why should I have to frame the "Frame" tag with a StackLayout tag? HeightRequest need some conditions to make it take effect. For example you could set a parent to it. Please check the following links: https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.visualelement.heightrequest?view=xamarin-forms https://stackoverflow.com/questions/35849565/understanding-widthrequest

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, October 22, 2018 7:02 AM