Ver código fonte

Fixed Scrolling In MobileListView
Updated Syncfusion Components

Frank van den Bos 1 ano atrás
pai
commit
676ba18b0b

+ 3 - 24
InABox.Mobile/InABox.Mobile.Shared/Components/MobileListView/MobileListView.xaml

@@ -8,43 +8,22 @@
     xmlns:system="clr-namespace:System;assembly=netstandard"
     x:Class="InABox.Mobile.MobileListView"
     BackgroundColor="Transparent"
-    x:DataType="local:MobileCollectionView">
+    x:DataType="local:MobileListView">
     <ContentView.Content>
         <Grid>
             <Grid.RowDefinitions>
                 <RowDefinition Height="*"/>
                 <RowDefinition Height="Auto"/>
             </Grid.RowDefinitions>
-            <RefreshView 
-                x:Name="_refresher"
-                BackgroundColor="Transparent"
-                Grid.Row="0"
-                IsEnabled="False">
 
-                <!-- ItemSizingStrategy="{Binding HasUnevenRows}" -->
                 <ListView  
                     x:Name="_list"
                     BackgroundColor="Transparent" 
                     SelectionMode="None"
                     SeparatorVisibility="Default"
-                    SeparatorColor="Transparent">
-                    <!-- <CollectionView.EmptyView> -->
-                    <!--     <ui:MaterialLabel  -->
-                    <!--         x:Name="_emptylist" -->
-                    <!--         Text="{Binding EmptyText}"  -->
-                    <!--         VerticalOptions="CenterAndExpand"  -->
-                    <!--         VerticalTextAlignment="Center" -->
-                    <!--         HorizontalOptions="CenterAndExpand" -->
-                    <!--         HorizontalTextAlignment="Center"  -->
-                    <!--         TypeScale="H6" -->
-                    <!--         TextColor="Gray"/>  -->
-                    <!-- </CollectionView.EmptyView> -->
-                    <!-- <CollectionView.ItemsLayout> -->
-                    <!--     <LinearItemsLayout ItemSpacing="{Binding Spacing}" Orientation="Vertical" /> -->
-                    <!-- </CollectionView.ItemsLayout> -->
+                    SeparatorColor="Transparent" 
+                    IsPullToRefreshEnabled="True">
                 </ListView>
-                
-            </RefreshView>
             
             <local:MobileCard
                 Grid.Row="1"

+ 8 - 32
InABox.Mobile/InABox.Mobile.Shared/Components/MobileListView/MobileListView.xaml.cs

@@ -25,7 +25,7 @@ namespace InABox.Mobile
             set
             {
                 SetValue(PullToRefreshProperty,value);
-                _refresher.IsEnabled = value;
+                _list.IsPullToRefreshEnabled = value;
                 UpdateSummaryRow();
             }
         }
@@ -125,21 +125,7 @@ namespace InABox.Mobile
             //_list.IsVisible = ItemsSource?.GetEnumerator().MoveNext() == true;
             //_nodata.IsVisible = !_list.IsVisible;
         }
-
-        private double _spacing;
-        public double Spacing
-        {
-            get => _spacing;
-            set
-            {
-                _spacing = value;
-                //var layout = _list?.ItemsLayout as LinearItemsLayout;
-                //if (layout != null)
-                //    layout.ItemSpacing = _spacing;
-            }
-        }
-
-
+        
         private bool _unevenrows;
         public bool HasUnevenRows
         {
@@ -148,12 +134,8 @@ namespace InABox.Mobile
             {
                 _unevenrows = value;
                 if (_list != null)
-                    // _list.ItemSizingStrategy =
-                    //     value 
-                    //         ? ItemSizingStrategy.MeasureAllItems 
-                    //         : ItemSizingStrategy.MeasureFirstItem;
                     _list.HasUnevenRows = value;
-                    //_list.AutoFitMode = value ? AutoFitMode.DynamicHeight : AutoFitMode.None;
+
             }
         }
         
@@ -162,22 +144,16 @@ namespace InABox.Mobile
         public MobileListView()
         {
             InitializeComponent();
-            _refresher.Command = new Command(DoRefresh);
-            Spacing = 5;
+            _list.RefreshCommand = new Command(DoRefresh);
             HasUnevenRows = true;
         }
         
         private void DoRefresh(object sender)
         {
-            if (_refresher != null)
-            {
-                //var src = _list.ItemsSource;
-                _list.ItemsSource = null;
-                _refresher.IsRefreshing = true;
-                RefreshRequested?.Invoke(sender, new MobileListRefreshEventArgs());
-                _refresher.IsRefreshing = false;
-                //_list.ItemsSource = src;
-            }
+            _list.ItemsSource = null;
+            _list.IsRefreshing = true;
+            RefreshRequested?.Invoke(sender, new MobileListRefreshEventArgs());
+            _list.IsRefreshing = false;
         }
         
     }

+ 7 - 7
InABox.Mobile/InABox.Mobile.Shared/InABox.Mobile.Shared.csproj

@@ -22,13 +22,13 @@
         </PackageReference>
         <PackageReference Include="Serilog" Version="3.0.1" />
         <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
-        <PackageReference Include="Syncfusion.Licensing" Version="23.2.4" />
-        <PackageReference Include="Syncfusion.Xamarin.Pdf" Version="23.2.4" />
-        <PackageReference Include="Syncfusion.Xamarin.SfBusyIndicator" Version="23.2.4" />
-        <PackageReference Include="Syncfusion.Xamarin.SfDataGrid" Version="23.2.4" />
-        <PackageReference Include="Syncfusion.Xamarin.SfPicker" Version="23.2.4" />
-        <PackageReference Include="Syncfusion.Xamarin.SfPopupLayout" Version="23.2.4" />
-        <PackageReference Include="Syncfusion.Xamarin.SfPullToRefresh" Version="23.2.4" />
+        <PackageReference Include="Syncfusion.Licensing" Version="23.2.6" />
+        <PackageReference Include="Syncfusion.Xamarin.Pdf" Version="23.2.6" />
+        <PackageReference Include="Syncfusion.Xamarin.SfBusyIndicator" Version="23.2.6" />
+        <PackageReference Include="Syncfusion.Xamarin.SfDataGrid" Version="23.2.6" />
+        <PackageReference Include="Syncfusion.Xamarin.SfPicker" Version="23.2.6" />
+        <PackageReference Include="Syncfusion.Xamarin.SfPopupLayout" Version="23.2.6" />
+        <PackageReference Include="Syncfusion.Xamarin.SfPullToRefresh" Version="23.2.6" />
         <PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
         <PackageReference Include="Xamarin.Forms" Version="5.0.0.2622" />
         <PackageReference Include="XF.Material" Version="1.8.0" />