Hi
I got a List View with Custom Cells. Looks like this.
<local:BasePage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mr="clr-namespace:MR.Gestures;assembly=MR.Gestures"
xmlns:cell="clr-namespace:pnyxnetmobile.Views.Cells"
xmlns:local="clr-namespace:pnyxnetmobile.Views"
x:Class="pnyxnetmobile.Views.Pages.AllCommentsTabbedPage"
x:Name="AllCommentsPage"
BackgroundColor="{StaticResource White}">
<mr:ListView x:Name="CommentsListview"
Style="{StaticResource Timeline}"
Swiped="ListView_Swiped"
ItemSelected="CommentsListview_ItemSelected"
ItemsSource="{Binding Model.PnyxoniumListSorted}"
SelectedItem="{Binding Model.SelectedGroup, Mode=TwoWay}"
RefreshCommand="{Binding RefreshAllCommand}"
IsRefreshing="{Binding Model.IsRefreshingAll}">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<cell:PnyxoniumCell Pnyxonium="{Binding Key}"
CellOnClickCommand="{Binding Source={x:Reference AllCommentsPage}, Path=BindingContext.CellOnClickCommand}"
SendReplyCommand="{Binding Source={x:Reference AllCommentsPage}, Path=BindingContext.SendReplyCommand}"
LikeCommand="{Binding Source={x:Reference AllCommentsPage}, Path=BindingContext.LikeCommand}"/>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<cell:RefPnyxoniumCell Pnyxonium="{Binding .}"
SelectedPnyxonium="{Binding Source={x:Reference AllCommentsPage}, Path=BindingContext.Model.SelectedPnyxonium}"
CellOnClickCommand="{Binding Source={x:Reference AllCommentsPage}, Path=BindingContext.CellOnClickCommand}"
SendReplyCommand="{Binding Source={x:Reference AllCommentsPage}, Path=BindingContext.SendReplyCommand}"
LikeCommand="{Binding Source={x:Reference AllCommentsPage}, Path=BindingContext.LikeCommand}"/>
</DataTemplate>
</ListView.ItemTemplate>
</mr:ListView>
</local:BasePage>
I want to add a scrollTo function where i scroll the selected, tapped item to the top of the screen.
I tried it this way:
private void CommentsListview_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
CommentsListview.ScrollTo(e.SelectedItem, ScrollToPosition.Start, true);
}
Since I got this working before when I used Xamarin.Forms Cells I wonder why its not workign anymore.
The ListView.SelectedItem is never assigned as well.