Srusti Thakkar
Srusti Thakkar

Reputation: 1901

Label not displaying text inside Frame

I am developing cross-platform App in Xamarin.Forms. I have used frame, Label and Button Control. Button display perfectly, but label doesn't display text inside Frame.

Screenshot of screen is

Screenshot of the screen

I also want to change button as a rounded corner. How's it possible?

How to change the bottom navigation bar color and textColor?

I am using BottomNavigationBar.XF plugin.

My code is:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="DhirenBhai_sApp.Views.StoresPage" Title="Stores">
<ContentPage.Content>
    <StackLayout>
        <StackLayout VerticalOptions="Start" BackgroundColor="LawnGreen" HeightRequest="40">
            <Label Text="Stores" TextColor="White" VerticalOptions="Center" HorizontalOptions="Center" FontSize="Large" />
        </StackLayout>
        <Frame VerticalOptions="FillAndExpand" Margin="10" BackgroundColor="Transparent" Padding="5" >
            <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="Stores" />
            <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="You don't have to worry about your money being stolen from online attacks." ></Label>
            <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="You now have the option to save your money offline, by your using a device."></Label>
            <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="Register and find out more about the offline storage device from service provider"></Label>
            <Button Text="Register" BackgroundColor="LawnGreen" Margin="5"  BorderWidth="50" TextColor="White" VerticalOptions="End" ></Button>
        </Frame>
    </StackLayout>
</ContentPage.Content>

Upvotes: 4

Views: 7164

Answers (1)

Mayur Kerasiya
Mayur Kerasiya

Reputation: 206

Try below code

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
 x:Class="DhirenBhai_sApp.Views.StoresPage" Title="Stores">
<ContentPage.Content>
    <StackLayout>
        <StackLayout VerticalOptions="Start" BackgroundColor="LawnGreen" HeightRequest="40">
            <Label Text="Stores" TextColor="White" VerticalOptions="Center" HorizontalOptions="Center" FontSize="Large" />
        </StackLayout>
        <Frame VerticalOptions="FillAndExpand" Margin="10" BackgroundColor="Transparent" Padding="5" >
            <StackLayout VerticalOptions="FillAndExpand">
                <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="Stores" />
                <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="You don't have to worry about your money being stolen from online attacks." ></Label>
                <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="You now have the option to save your money offline, by your using a device."></Label>
                <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="Register and find out more about the offline storage device from service provider"></Label>
                <Button Text="Register" BackgroundColor="LawnGreen" Margin="5"  BorderWidth="50" TextColor="White" VerticalOptions="End" ></Button>
            </StackLayout>
        </Frame>
    </StackLayout>
</ContentPage.Content>


Note:- Frame contains only one child that is why you have to take another layout to contain all the label and button

Upvotes: 8

Related Questions