This commit is contained in:
Tsanie Lily 2022-03-05 08:40:18 +08:00
parent bc5cf4afa5
commit 0c3b8c52bd
3 changed files with 10 additions and 5 deletions

View File

@ -122,8 +122,9 @@ namespace Billing.UI
{
return;
}
var padding = Padding;
var spacing = Spacing;
var lastHeight = 0d;
var lastHeight = padding.Top;
var rowHeight = RowHeight;
var groupHeight = GroupHeight;
foreach (var item in Children)
@ -154,7 +155,7 @@ namespace Billing.UI
{
itemHeight = rowHeight;
}
var rect = new Rectangle(0, lastHeight, width, itemHeight);
var rect = new Rectangle(padding.Left, lastHeight, width, itemHeight);
//item.Layout(rect);
LayoutChildIntoBoundingRegion(item, rect);
lastHeight += itemHeight + spacing;
@ -185,7 +186,8 @@ namespace Billing.UI
lastHeight += rowHeight + spacing;
}
}
lastSizeRequest = new SizeRequest(new Size(widthConstraint, lastHeight));
var padding = Padding;
lastSizeRequest = new SizeRequest(new Size(widthConstraint, lastHeight + padding.Top + padding.Bottom));
return lastSizeRequest;
}
}

View File

@ -75,9 +75,9 @@
</StackLayout>
</Grid>
<!-- bill list -->
<ScrollView Grid.Row="2">
<ScrollView x:Name="scrollView" Grid.Row="2">
<ui:GroupStackLayout x:Name="billsLayout" ItemsSource="{Binding Bills}"
Margin="0, 10, 0, 0" RowHeight="50">
Padding="0, 10, 0, 0" RowHeight="50">
<ui:GroupStackLayout.ItemTemplate>
<DataTemplate x:DataType="v:UIBill">
<ui:LongPressGrid Padding="20, 0" ColumnSpacing="10"

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xamarin.Essentials;
using Xamarin.Forms;
namespace Billing.Views
@ -43,6 +44,7 @@ namespace Billing.Views
EditBilling = new Command(OnEditBilling);
DeleteBilling = new Command(OnDeleteBilling);
SelectedDate = DateTime.Now;
InitializeComponent();
billingDate.SetDateTime(DateTime.Now);
@ -60,6 +62,7 @@ namespace Billing.Views
b.CreateTime.Day == e.Date.Day);
Bills = new List<UIBill>(bills.Select(b => WrapBill(b)));
RefreshBalance(Bills);
MainThread.BeginInvokeOnMainThread(async () => await scrollView.ScrollToAsync(0, 0, true));
});
}