Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

How can i make a label fit/ auto size the grid row and column specified for it?

$
0
0

Hi,
I am using Grid layout to try making the app responsive and when i use label and set a font size to it, the label sometimes surpasses the space (grid.row & grid.colum) alocated for it.

Is it possible to make the label always fit the alocated space ?

<Grid RowSpacing="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="3.5*"/>
                <RowDefinition Height="6.5*"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0" Grid.Column="0">
                <Image x:Name="imagemNav" Grid.Row="0" Grid.Column="0" Source="{local:ImageResource KiaiDay.Images.navigationImage.png}" Aspect="Fill"
                    HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/>
                <Grid Padding="20,10,20,0" ColumnSpacing="0" RowSpacing="0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="3.5*"/>
                        <RowDefinition Height="4.5*"/>
                        <RowDefinition Height="2*"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="6*"/>
                        <ColumnDefinition Width="4*"/>
                    </Grid.ColumnDefinitions>

...
                    <StackLayout Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Spacing="4">
                        <Label Text="Some text" FontSize="50" TextColor="White" FontFamily="{ StaticResource RegularFont}" Margin="20,0,0,0"/>
                        <Label Text="Some other text" FontSize="20" TextColor="White" FontFamily="{ StaticResource LightFont  }" Margin="25,-10,0,0"     
                                    Opacity="0.7"/>
                    </StackLayout>
...
</Grid>

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>