Created
August 9, 2017 08:40
-
-
Save mathiassoeholm/34c7f33443ca6a494747e6e75167ff1e to your computer and use it in GitHub Desktop.
CarouselView problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions" | |
xmlns:local="clr-namespace:StackLayoutBug" | |
x:Class="StackLayoutBug.MainPage" | |
SizeChanged="OnPageSizeChanged"> | |
<Grid ColumnSpacing="0" RowSpacing="0"> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="Auto"/> | |
<RowDefinition Height="*"/> | |
</Grid.RowDefinitions> | |
<Grid.ColumnDefinitions> | |
<ColumnDefinition Width="*"/> | |
</Grid.ColumnDefinitions> | |
<ContentView Grid.Row="0" Grid.Column="0" BackgroundColor="BlueViolet" HorizontalOptions="FillAndExpand" VerticalOptions="Start"> | |
<StackLayout x:Name="StackLayout"> | |
<Label Text="A" FontSize="Large"/> | |
<Label Text="B" FontSize="Large"/> | |
</StackLayout> | |
</ContentView> | |
<controls:CarouselViewControl | |
x:Name="carouselView" | |
Orientation="Horizontal" | |
Grid.Row="1" Grid.Column="0" | |
BackgroundColor="DarkSlateGray"> | |
<controls:CarouselViewControl.ItemsSource> | |
<x:Array Type="{x:Type View}"> | |
<ContentView> | |
<ScrollView> | |
<StackLayout> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
<Label Text="TEST" FontSize="70"/> | |
</StackLayout> | |
</ScrollView> | |
</ContentView> | |
</x:Array> | |
</controls:CarouselViewControl.ItemsSource> | |
</controls:CarouselViewControl> | |
</Grid> | |
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xamarin.Forms; | |
namespace StackLayoutBug | |
{ | |
public partial class MainPage : ContentPage | |
{ | |
public MainPage() | |
{ | |
InitializeComponent(); | |
} | |
private void OnPageSizeChanged(object sender, EventArgs e) | |
{ | |
if (Width < Height) | |
{ | |
StackLayout.Orientation = StackOrientation.Vertical; | |
} | |
else | |
{ | |
StackLayout.Orientation = StackOrientation.Horizontal; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment