I'm having a problem coding right now on my Xamarin.Forms application. I have a list view with a StackLayout in it (worked well). But when I saw SwipeView existed, I updated to the lastest version of Xamarin.Forms (4.4.0.991640) and made this xaml code :
<StackLayout Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" BackgroundColor="LightGray">
<ListView x:Name="ItemsListView"
ItemsSource="{Binding Items}"
VerticalOptions="FillAndExpand"
HasUnevenRows="true"
RefreshCommand="{Binding LoadItemsCommand}"
IsPullToRefreshEnabled="true"
IsRefreshing="{Binding IsBusy, Mode=OneWay}"
CachingStrategy="RecycleElement"
ItemSelected="OnItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Favorite"
BackgroundColor="LightGreen"
Invoked="OnModifySwipeItemInvoked" />
<SwipeItem Text="Delete"
BackgroundColor="LightPink"
Invoked="OnDeleteSwipeItemInvoked" />
</SwipeItems>
</SwipeView.RightItems>
<SwipeView.Content>
<StackLayout Padding="10" BackgroundColor="{Binding ColorCode}">
<Label Text="{Binding Type}"
d:Text="{Binding .}"
LineBreakMode="NoWrap"
Style="{DynamicResource ListItemTextStyle}"
FontSize="Large"
HorizontalOptions="Center"/>
<Label Text="{Binding Description}"
d:Text="Item descripton"
LineBreakMode="NoWrap"
Style="{DynamicResource ListItemDetailTextStyle}"
FontSize="Medium"
HorizontalOptions="Center"/>
</StackLayout>
</SwipeView.Content>
</SwipeView>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
At first I have no items, so it doesn't crash. But at soon as I add an item, so that I return to this page, I have the exception :
System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'
No try catches possible because it happens when I come back to page and I tried with unhandleexception but still didn't get more informations...
If you need more info, please ask me. Can you please help me? Thanks!