attempted workaround for arg outof range exception

This commit is contained in:
Kyle Spearrin 2019-06-05 00:15:54 -04:00
parent 1ef086a02c
commit 96275d8eec
3 changed files with 11 additions and 0 deletions

View file

@ -79,6 +79,7 @@
</StackLayout> </StackLayout>
<controls:ExtendedListView <controls:ExtendedListView
x:Name="_listView"
IsVisible="{Binding ShowList}" IsVisible="{Binding ShowList}"
ItemsSource="{Binding GroupedItems}" ItemsSource="{Binding GroupedItems}"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"

View file

@ -1,4 +1,5 @@
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Bit.App.Controls;
using Bit.App.Resources; using Bit.App.Resources;
using Bit.Core; using Bit.Core;
using Bit.Core.Abstractions; using Bit.Core.Abstractions;
@ -26,6 +27,7 @@ namespace Bit.App.Pages
{ {
_pageName = string.Concat(nameof(GroupingsPage), "_", DateTime.UtcNow.Ticks); _pageName = string.Concat(nameof(GroupingsPage), "_", DateTime.UtcNow.Ticks);
InitializeComponent(); InitializeComponent();
ListView = _listView;
SetActivityIndicator(_mainContent); SetActivityIndicator(_mainContent);
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService"); _broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
_syncService = ServiceContainer.Resolve<ISyncService>("syncService"); _syncService = ServiceContainer.Resolve<ISyncService>("syncService");
@ -57,6 +59,8 @@ namespace Bit.App.Pages
} }
} }
public ExtendedListView ListView { get; set; }
protected async override void OnAppearing() protected async override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();

View file

@ -127,6 +127,7 @@ namespace Bit.App.Pages
ShowList = false; ShowList = false;
ShowAddCipherButton = true; ShowAddCipherButton = true;
var groupedItems = new List<GroupingsPageListGroup>(); var groupedItems = new List<GroupingsPageListGroup>();
var page = Page as GroupingsPage;
try try
{ {
@ -203,7 +204,12 @@ namespace Bit.App.Pages
ciphersListItems.Count, Device.RuntimePlatform == Device.iOS, ciphersListItems.Count, Device.RuntimePlatform == Device.iOS,
!MainPage && !groupedItems.Any())); !MainPage && !groupedItems.Any()));
} }
// Workaround for https://stackoverflow.com/a/49992132/1090359
page.ListView.HasUnevenRows = false;
page.ListView.IsGroupingEnabled = false;
GroupedItems.ResetWithRange(groupedItems); GroupedItems.ResetWithRange(groupedItems);
page.ListView.HasUnevenRows = true;
page.ListView.IsGroupingEnabled = true;
} }
finally finally
{ {