private void ListView_Loaded(object sender, ListViewLoadedEventArgs e)
{
listView2.BindingContext = listView;
listView2.ItemsSource = listView.DataSource.Groups;
} |
private void ListView2_QueryItemSize(object sender, QueryItemSizeEventArgs e)
{
for (int i = 0; i < listView.DataSource.Groups.Count; i++)
{
itemSize = (listView.DataSource.Groups[i].Count / gridLayout.SpanCount) * listView.ItemSize;
if (listView.DataSource.Groups[i].Count % 2 != 0)
e.ItemSize = itemSize + listView2.ItemSize;
else
e.ItemSize = itemSize;
}
} |
public partial class GridLayoutPage : ContentPage
{
ExtendedScrollView scrollview;
ScrollAxisBase scrollRows;
VisualContainer visualContainer;
public GridLayoutPage()
{
InitializeComponent();
visualContainer = listView.GetType().GetRuntimeProperties().First(p => p.Name == "VisualContainer").GetValue(listView) as VisualContainer;
scrollRows = visualContainer.GetType().GetRuntimeProperties().First(p => p.Name == "ScrollRows").GetValue(visualContainer) as ScrollAxisBase;
scrollRows.Changed += ScrollRows_Changed;
scrollview = visualContainer.GetType().GetRuntimeProperties().First(x => x.Name == "ScrollOwner").GetValue(visualContainer) as ExtendedScrollView;
}
private void ScrollRows_Changed(object sender, ScrollChangedEventArgs e)
{
listView2.ScrollTo(scrollview.ScrollX);
}
} |