--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<controls:TestContentPage
+ xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:d="http://xamarin.com/schemas/2014/forms/design"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:controls="clr-namespace:Xamarin.Forms.Controls"
+ mc:Ignorable="d"
+ x:Class="Xamarin.Forms.Controls.Issues.Issue7758">
+ <ContentPage.Resources>
+ <ResourceDictionary>
+ <Style TargetType="StackLayout" x:Key="StackLayoutStyle">
+ <Setter Property="Orientation" Value="Vertical"/>
+ <Setter Property="HorizontalOptions" Value="Center"/>
+ <Setter Property="VerticalOptions" Value="Center"/>
+ <Setter Property="Padding" Value="20, 0"/>
+ <Setter Property="Spacing" Value="10"/>
+ <Setter Property="BackgroundColor" Value="Wheat"/>
+ </Style>
+ </ResourceDictionary>
+ </ContentPage.Resources>
+ <Grid RowSpacing="0">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition/>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+
+ <Grid Grid.Row="0" BackgroundColor="Black" Padding="10">
+ <Label Text="If the red line is not between Item 3 and Item 4, the test has failed. Change device orientation to landscape. If the red line is not between Item 3 and Item 4, the test has failed. If there is a visible white background during orientation change, the test has failed." TextColor="White"/>
+ </Grid>
+
+ <CollectionView Grid.Row="1">
+ <CollectionView.EmptyView>
+ <ContentView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="Beige">
+ <StackLayout Style="{x:StaticResource StackLayoutStyle}">
+ <Label Text="Text1" HorizontalTextAlignment="Center" FontAttributes="Bold" FontSize="14.5"/>
+ <Label Text="Text2" HorizontalTextAlignment="Center" TextColor="#636571" FontSize="14.5"/>
+ <Label Text="Text3" HorizontalTextAlignment="Center" FontAttributes="Bold" FontSize="14.5"/>
+ <Label Text="Text4" HorizontalTextAlignment="Center" TextColor="#636571" FontSize="14.5"/>
+ <Label Text="Text5" HorizontalTextAlignment="Center" FontAttributes="Bold" FontSize="14.5"/>
+ <Label Text="Text6" HorizontalTextAlignment="Center" TextColor="#636571" FontSize="14.5"/>
+ </StackLayout>
+ </ContentView>
+ </CollectionView.EmptyView>
+ </CollectionView>
+
+ <Grid Grid.Row="2" BackgroundColor="Black" HeightRequest="50"/>
+
+ <Grid Grid.Row="1" BackgroundColor="Red" HeightRequest="5" VerticalOptions="Center"/>
+ </Grid>
+</controls:TestContentPage>
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Github, 7758, "[iOS] EmptyView is not rendered in screen center", PlatformAffected.iOS)]
+ public partial class Issue7758 : TestContentPage
+ {
+ public Issue7758()
+ {
+#if APP
+ Device.SetFlags(new List<string> { CollectionView.CollectionViewExperimental });
+
+ InitializeComponent();
+#endif
+ }
+
+ protected override void Init()
+ {
+
+ }
+ }
+}
\ No newline at end of file
<Compile Include="$(MSBuildThisFileDirectory)Issue7519Xaml.xaml.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="$(MSBuildThisFileDirectory)Issue7758.xaml.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue7593.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="$(MSBuildThisFileDirectory)Issue7593.xaml.cs">
<DependentUpon>Issue7593.xaml</DependentUpon>
</Compile>
+ <Compile Update="$(MSBuildThisFileDirectory)Issue7758.xaml.cs">
+ <DependentUpon>Issue7758.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue1455.xaml">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
-</Project>
+ <ItemGroup>
+ <EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue7758.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
+</Project>
\ No newline at end of file
if (!_initialConstraintsSet)
{
ItemsViewLayout.ConstrainTo(CollectionView.Bounds.Size);
+ UpdateEmptyView();
_initialConstraintsSet = true;
}
+ else
+ {
+ ResizeEmptyView();
+ }
}
protected virtual UICollectionViewDelegator CreateDelegator()
UpdateEmptyViewVisibility(ItemsSource?.ItemCount == 0);
}
+ void ResizeEmptyView()
+ {
+ if (_emptyUIView != null)
+ _emptyUIView.Frame = CollectionView.Frame;
+
+ if (_emptyViewFormsElement != null)
+ _emptyViewFormsElement.Layout(CollectionView.Frame.ToRectangle());
+ }
+
protected void UpdateSubview(object view, DataTemplate viewTemplate, ref UIView uiView, ref VisualElement formsElement)
{
uiView?.RemoveFromSuperview();