Click here to Skip to main content
15,504,549 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used ItemAppearing and ItemDisappearing events but it is not working as per my requirement(It is working fine in iOS but not in android)and i created custom render for listview for listview scroll I failed to do that. Can anyone please help me out.

What I have tried:

private void scheduleservicelist_itemappearing(object sender, xamarin.forms.itemvisibilityeventargs e)
{
var currentitem = e.item as mymodel;

if (viewmodel.mylistlist[0].id == currentitem.id)
{
headerlayout.isvisible = true;
headinggrid.margin = new thickness(0, -70, 0, 0);
}

}

private void scheduleservicelist_itemdisappearing(object sender, itemvisibilityeventargs e)
{
var currentitem = e.item as mymodel;

if (viewmodel.mylistlist[0].id == currentitem.id)
{
headerlayout.isvisible = false;
headinggrid.margin = new thickness(0, 0, 0, 0);

}
}



private void ScheduleServiceListView_Scrolled(object sender, ScrolledEventArgs e)
{


double scrollposition = e.ScrollY;
if (scrollposition > previousScrollposition)
{
isScrollUp = true;
isScrollDown = false;
}
else if(scrollposition < previousScrollposition)
{
isScrollDown = true;
isScrollUp = false;
}
else
{
if (isScrollUp)
{
isScrollUp = true;
isScrollDown = false;
} else
{
isScrollDown = true;
isScrollUp = false;
}
scrollposition = 0;
}

if (isScrollUp )
{
HeaderLayout.IsVisible = false;
HeadingGrid.Margin = new Thickness(0, 0, 0, 0);
HeadingGrid.VerticalOptions = LayoutOptions.Start;

}
else
{
HeaderLayout.IsVisible = true;
HeadingGrid.Margin = new Thickness(0, -70, 0, 0);
}
previousScrollposition = scrollposition;

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900