The problem is in scroll bar, if i scroll to the 1st column of the data in the horizontal direction and then try to scroll in the 0th column of data virtically, the scroll automatically comes to the first position of the 1st column of data.
Any help is appreciated. Thanks!
Scrolled event code:
private async void 1stColScrollView_Scrolled;(object sender, ScrolledEventArgs e)
{
await rowScrollView.ScrollToAsync(0, e.ScrollY, false);
await colScrollView.ScrollToAsync(e.ScrollX, 0, false);
}
private async void 0thColScrollView_Scrolled(object sender, ScrolledEventArgs e)
{
await dataScrollView.ScrollToAsync(0, e.ScrollY, false);
}
private async void 1thColScrollView_Scrolled(object sender, ScrolledEventArgs e)
{
await dataScrollView.ScrollToAsync(e.ScrollX, 0, false);
}
and call:
dataScrollView.Scrolled = 1stColScrollView_Scrolled;
rowScrollView.Scrolled = 0thColScrollView_Scrolled;
colScrollView.Scrolled = 1thColScrollView_Scrolled;
CodePudding user response:
The cause is the 0 in the 0thColScrollView_Scrolled
and the 1thColScrollView_Scrolled
. You need to keep the dataScrollView's ScrollY when it scrolls horizontally and keep the ScrollX when it scrolls vertically. Such as:
private async void 0thColScrollView_Scrolled(object sender, ScrolledEventArgs e)
{
await dataScrollView.ScrollToAsync(dataScrollView.ScrollX, e.ScrollY, false);
}
private async void 1thColScrollView_Scrolled(object sender, ScrolledEventArgs e)
{
await dataScrollView.ScrollToAsync(e.ScrollX, dataScrollView.ScrollY, false);
}