-
Notifications
You must be signed in to change notification settings - Fork 760
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ListView): ios lv snap rubber-banding
- Loading branch information
Showing
4 changed files
with
142 additions
and
1 deletion.
There are no files selected for viewing
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
98 changes: 98 additions & 0 deletions
98
...SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_Snap_Rubberband.xaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<UserControl x:Class="SamplesApp.Windows_UI_Xaml_Controls.ListView.ListView_Snap_Rubberband" | ||
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:xamarin="http://uno.ui/xamarin" | ||
mc:Ignorable="d xamarin" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<UserControl.Resources> | ||
<Style x:Key="TestHorizontalLVStyle" TargetType="ListView"> | ||
<Setter Property="IsTabStop" Value="False" /> | ||
<Setter Property="TabNavigation" Value="Once" /> | ||
<Setter Property="IsSwipeEnabled" Value="True" /> | ||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Visible" /> | ||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" /> | ||
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Enabled" /> | ||
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Disabled" /> | ||
<Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="True" /> | ||
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="False" /> | ||
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" /> | ||
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True" /> | ||
<Setter Property="ItemContainerTransitions"> | ||
<Setter.Value> | ||
<TransitionCollection> | ||
<AddDeleteThemeTransition /> | ||
<ContentThemeTransition /> | ||
<ReorderThemeTransition /> | ||
<EntranceThemeTransition IsStaggeringEnabled="False" /> | ||
</TransitionCollection> | ||
</Setter.Value> | ||
</Setter> | ||
|
||
<Setter Property="ItemsPanel"> | ||
<Setter.Value> | ||
<ItemsPanelTemplate> | ||
<ItemsStackPanel Orientation="Horizontal" /> | ||
</ItemsPanelTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="ListView"> | ||
<ScrollViewer x:Name="ScrollViewer" | ||
xamarin:Style="{StaticResource ListViewBaseScrollViewerStyle}" | ||
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" | ||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" | ||
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" | ||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" | ||
IsHorizontalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsHorizontalScrollChainingEnabled}" | ||
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" | ||
IsVerticalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsVerticalScrollChainingEnabled}" | ||
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" | ||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" | ||
BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}" | ||
AutomationProperties.AccessibilityView="Raw" | ||
HorizontalSnapPointsType="MandatorySingle" | ||
HorizontalSnapPointsAlignment="Center"> | ||
<ItemsPresenter Header="{TemplateBinding Header}" | ||
HeaderTemplate="{TemplateBinding HeaderTemplate}" | ||
HeaderTransitions="{TemplateBinding HeaderTransitions}" | ||
Footer="{TemplateBinding Footer}" | ||
FooterTemplate="{TemplateBinding FooterTemplate}" | ||
FooterTransitions="{TemplateBinding FooterTransitions}" | ||
Padding="{TemplateBinding Padding}" /> | ||
</ScrollViewer> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
<Style x:Key="TestLVIStyle" TargetType="ListViewItem"> | ||
<Setter Property="Padding" Value="0" /> | ||
<Setter Property="MinWidth" Value="0" /> | ||
<Setter Property="MinHeight" Value="1" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="ListViewItem"> | ||
<ContentPresenter Content="{TemplateBinding Content}" | ||
ContentTemplate="{TemplateBinding ContentTemplate}" | ||
xamarin:ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" /> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
</UserControl.Resources> | ||
|
||
<Grid Width="100" Height="100"> | ||
<ListView ItemsSource="{Binding}" ItemContainerStyle="{StaticResource TestLVIStyle}" Style="{StaticResource TestHorizontalLVStyle}"> | ||
<ListView.ItemTemplate> | ||
<DataTemplate> | ||
<Border Padding="5" Width="90" Height="90" Background="Pink"> | ||
<TextBlock Text="{Binding}" HorizontalAlignment="Center" /> | ||
</Border> | ||
</DataTemplate> | ||
</ListView.ItemTemplate> | ||
</ListView> | ||
</Grid> | ||
</UserControl> |
35 changes: 35 additions & 0 deletions
35
...plesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_Snap_Rubberband.xaml.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
using Uno.UI.Samples.Controls; | ||
using Uno.UI.Samples.Tests; | ||
using Uno.UI.Samples.UITests.Helpers; | ||
|
||
namespace SamplesApp.Windows_UI_Xaml_Controls.ListView | ||
{ | ||
[SampleControlInfo("AAAListView", nameof(ListView_Snap_Rubberband), IsManualTest = true, Description = SampleDescription)] | ||
public sealed partial class ListView_Snap_Rubberband : UserControl | ||
{ | ||
private const string SampleDescription = | ||
"[ManualTest]: While the LV is snapped to the 1st item, wait at least 1second. " + | ||
"Using flipping gesture, over-scroll to left, and then quickly (within 250ms) scroll to the right. " + | ||
"The LV should snap to the 2nd item, and not rubber banding back to the first."; | ||
|
||
public ListView_Snap_Rubberband() | ||
{ | ||
this.InitializeComponent(); | ||
this.DataContext = new[] { 0, 1, 2 }; | ||
} | ||
} | ||
} |
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