0

this is my first post and i'm here as a newbie developer.

I'm working in a collaboration project for a mobile app and i'm actually stuck with a problem, maybe is something simple for experienced developers but i'm starting now with Xamarin.Forms and MVVM Cross framework with school-only experience.

I have a View Model for a Tabbed Page that will work as a Wrapper for a few pages, i'm actually working with the first and (atm) only page and i need to bind a Observable Collection to a List View.

The problem is that at the moment the List View is located in the single page wrapped inside the Tabbed, but the collection is inside the View Model of the Tabbed Page, i don't know if this is a correct configuration for the result that i want to obtain but i'm trying to work with binding contexts, paths and similar things but i didn't figure it out.

When opening the page i obtain the exception "System.Reflection.TargetInvocationException:** 'Exception has been thrown by the target of an invocation."

Could you please help me?

Thank you in advance.

  • `TargetInvocationException` usually has an `InnerException` property that will tell you more about the root cause of the exception – Jason May 31 '21 at 21:36
  • First, for better suggestions, need to post either your code or the exception details or both. Common reasons of TargetInvocationException: 1. xaml bad binding. 2. bad constructor of the page. Try to set a break point at "InitializeComponent" of your page, if exception happens there, then it means something wrong in your xaml. Then narrow down your xaml content, i.e. comment out some of the page elements, or try to test with a [minimal-reproducible-example](https://stackoverflow.com/help/minimal-reproducible-example) – Shaw May 31 '21 at 21:50
  • Thank you guys, i'll check the suggestions and if needed i'll return with more informations. – AegisVII Jun 01 '21 at 20:25
  • Hi Everyone, i've worked at this issue with my colleague and the problem seemed to be related to the Tabbed View, with only one tab (it was the first and i was testing it alone), it seemed that the Tabbed didn't trigger the ViewAppearing method, so the relation between graphics and the view model wasn't established, so the binding. Thank you for the help. – AegisVII Jun 07 '21 at 21:48

0 Answers0