Doctor Ford
Doctor Ford

Reputation: 568

Label Is Never Showing

I am attempting to add a label above my button but the label never shows. This is the code xaml that I am using. What is it that keeps the label from being displayed?

            <Frame HasShadow="False">
            <StackLayout Orientation="Vertical" Spacing="10"> 
                <Label x:Name="registererror"  Text="Error, please verify all fields have valid input" TextColor="Red" />
            </StackLayout>
            <Button Command="{Binding SubmitCommand}" Text="Register" TextColor="White"  
                FontAttributes="Bold" FontSize="Large" HorizontalOptions="FillAndExpand"  
                BackgroundColor="#088da5" Clicked="OnRegisterTap" />  
        </Frame>

Upvotes: 2

Views: 56

Answers (1)

Jason
Jason

Reputation: 89082

a Frame can only have a single child. To contain multiple children you must use a layout container. Your Button is not enclosed in the StackLayout.

 <Frame HasShadow="False">
        <StackLayout Orientation="Vertical" Spacing="10"> 
            <Label x:Name="registererror"  Text="Error, please verify all fields have valid input" TextColor="Red" />

            <Button Command="{Binding SubmitCommand}" Text="Register" TextColor="White"  
            FontAttributes="Bold" FontSize="Large" HorizontalOptions="FillAndExpand"  
            BackgroundColor="#088da5" Clicked="OnRegisterTap" />  
        </StackLayout>
    </Frame>

Upvotes: 1

Related Questions