Hello friends,
I do a project using reusable controls and i have a problem when i use several views in a stacklayout when it is contained in a cell grid, the stacklayout overflow the cell.
To explain my issue , i show you with a simple project.
This project is divided in three xaml
My main page : the page is divided in four cell grid.
<Grid Padding="10" >
<Grid.RowDefinitions>
<RowDefinition Height="0.50*"/>
<RowDefinition Height="0.50*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.50*"/>
<ColumnDefinition Width="0.50*"/>
</Grid.ColumnDefinitions>
<c:Container VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Grid.Column="0" Grid.Row="0"/>
<StackLayout Grid.Column="1" Grid.Row="0" BackgroundColor="Transparent">
<Label x:Name="label2" Text="TWO" TextColor="Green"/>
</StackLayout>
<StackLayout Grid.Column="0" Grid.Row="1" BackgroundColor="Transparent">
<Label x:Name="label3" Text="THREE" TextColor="Red"/>
</StackLayout>
<StackLayout Grid.Column="1" Grid.Row="1" BackgroundColor="Transparent">
<Label x:Name="label4" Text="FOUR" TextColor="Gray"/>
</StackLayout>
</Grid>
My container : the container can be used in other cell. in this simple project , this container contain only my reusable control.
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<controls:Control />
<!--<Button Text="OK" />-->
</StackLayout>
My reusable control : This control can be used in other project.
<StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
<Label x:Name="label1" BackgroundColor="Blue" />
<Label x:Name="label2" BackgroundColor="Teal" />
</StackLayout>
Result : we can see my reusable control overflow the first cell grid. (screen_1)
I want the same result than when i have only one label in the reusable control , the stacklayout (control) doesn't overflow. (screen_2)
source : https://github.com/Masivo91/Xamarin/tree/master/TestGrid/TestGrid/TestGrid
Thanks in advance.