Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to infinite loop with listviewHeaders #1307

Merged
merged 5 commits into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,20 @@ public void ListView_ListViewVariableItemHeightLong_InitializesTest()
// Assert initial state
Assert.IsNotNull(theListView.GetDependencyPropertyValue("DataContext"));
}

// HorizontalListViewGrouped isn't present on WASM
[Test]
[AutoRetry]
[ActivePlatforms(Platform.iOS, Platform.Android)]
NicolasChampagne marked this conversation as resolved.
Show resolved Hide resolved
public void ListView_ListViewWithHeader_InitializesTest()
{
Run("SamplesApp.Windows_UI_Xaml_Controls.ListView.HorizontalListViewGrouped");

_app.WaitForElement(_app.Marked("TargetListView"));
var theListView = _app.Marked("TargetListView");

// Assert initial state
Assert.IsNotNull(theListView.GetDependencyPropertyValue("DataContext"));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
<UserControl
x:Class="SamplesApp.Windows_UI_Xaml_Controls.ListView.HorizontalListViewGrouped"
xmlns:controls="using:Uno.UI.Samples.Controls"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="using:Uno.UI.Samples.Controls"
xmlns:ios="http://uno.ui/ios"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:android="http://uno.ui/android"
xmlns:xamarin="http://uno.ui/xamarin"
mc:Ignorable="d ios android xamarin"
d:DesignHeight="2000"
d:DesignWidth="400">
<UserControl x:Class="SamplesApp.Windows_UI_Xaml_Controls.ListView.HorizontalListViewGrouped"
xmlns:controls="using:Uno.UI.Samples.Controls"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="using:Uno.UI.Samples.Controls"
xmlns:ios="http://uno.ui/ios"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:android="http://uno.ui/android"
xmlns:xamarin="http://uno.ui/xamarin"
mc:Ignorable="d ios android xamarin"
d:DesignHeight="2000"
d:DesignWidth="400">
<UserControl.Resources>

<Style TargetType="ListViewHeaderItem"
x:Key="GroupHeaderContainerStyle">
x:Key="GroupHeaderContainerStyle">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border BorderBrush="Orange"
BorderThickness="10">
BorderThickness="10">
<ContentPresenter xamarin:Content="{TemplateBinding Content}"
xamarin:ContentTemplate="{TemplateBinding ContentTemplate}"
xamarin:ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
xamarin:ContentTemplate="{TemplateBinding ContentTemplate}"
xamarin:ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
</Border>
</ControlTemplate>
</Setter.Value>
Expand All @@ -38,46 +37,48 @@
<DataTemplate>
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="SelectedIndex: "/>
<TextBlock Text="{Binding ElementName=TargetListView, Path=SelectedIndex}"/>
<TextBlock Text="SelectedIndex: " />
<TextBlock Text="{Binding ElementName=TargetListView, Path=SelectedIndex}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="SelectedItem: "/>
<TextBlock Text="{Binding ElementName=TargetListView, Path=SelectedItem}"/>
<TextBlock Text="SelectedItem: " />
<TextBlock Text="{Binding ElementName=TargetListView, Path=SelectedItem}" />
</StackPanel>
<Border Background="Red">
<ListView x:Name="TargetListView"
Height="300"
ItemsSource="{Binding [GroupedSampleItemsAsSource]}"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollMode="Auto"
Header="Header"
Footer="Footer">
Height="300"
ItemsSource="{Binding [GroupedSampleItemsAsSource]}"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollMode="Auto"
Header="Header"
Footer="Footer">
<ListView.HeaderTemplate>
<DataTemplate>
<Border Background="Green"
HorizontalAlignment="Stretch">
HorizontalAlignment="Stretch">
<TextBlock Text="{Binding}"
Margin="20" />
Margin="20" />
</Border>
</DataTemplate>
</ListView.HeaderTemplate>
<ListView.FooterTemplate>
<DataTemplate>
<Border Background="Purple">
<TextBlock Text="{Binding}"
Margin="20" />
Margin="20" />
</Border>
</DataTemplate>
</ListView.FooterTemplate>
<ListView.GroupStyle>
<GroupStyle HidesIfEmpty="True"
HeaderContainerStyle="{StaticResource GroupHeaderContainerStyle}"
>
<GroupStyle HidesIfEmpty="True"
HeaderContainerStyle="{StaticResource GroupHeaderContainerStyle}">
<GroupStyle.HeaderTemplate>
<DataTemplate>
<Border Background="Blue">
<TextBlock Text="{Binding Key}" Foreground="Red" FontSize="32" Height="40"/>
<TextBlock Text="{Binding Key}"
Foreground="Red"
FontSize="32"
Height="40" />
</Border>
</DataTemplate>
</GroupStyle.HeaderTemplate>
Expand All @@ -86,14 +87,16 @@
<ListView.ItemTemplate>
<DataTemplate>
<Border Background="White">
<TextBlock Text="{Binding}" Foreground="Blue" Height="16"/>
<TextBlock Text="{Binding}"
Foreground="Blue"
Height="16" />
</Border>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel Orientation="Horizontal"
GroupHeaderPlacement="Top"/>
GroupHeaderPlacement="Top" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ private protected override void UpdateLayoutAttributesForItem(UICollectionViewLa
{
UpdateLayoutAttributesForGroupHeader(elementToAdjust, extentDifference, true);
}

updatingItem = null;
}
}
}
Expand Down