Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>

like image 514
Srusti Thakkar Avatar asked Mar 08 '23 02:03

Srusti Thakkar


1 Answers

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

like image 156
Mayur Kerasiya Avatar answered Mar 16 '23 11:03

Mayur Kerasiya