Unable to delete Item swipe view

Eduardo Gomez 3,426 Reputation points
2020-12-31T04:03:10.133+00:00

Hello everyone

For some reason, my SQLite cannot populate a CollectionView from a viewModel (I load the data in the onApeared, and try to load the data to a collectionView in the viewModel) None of these worked so I opted for code-behind.

I declared a swipe view, to delete the item, the problem comes, when I want to delete the item, if I try to use MVVM I can't because my data is not in the view model.

I tried to access my ObservebableCollection in the code behind, from the view model, and remove it, but for some reason my Observable collectino is null,

I also tried to notify the code behind by using the messaging center and nothing

The biggest problem is that from the code behind, I cannot get the item that is currently swiping

At least with MVVM I can do something like {x:bindindg} and send the entire object to the view model

Is someone wants to poke around with it and help me, here is the link

WhereToGo

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,362 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,949 questions
0 comments No comments
{count} votes

Accepted answer
  1. Cole Xia (Shanghai Wicresoft Co,.Ltd.) 6,751 Reputation points
    2020-12-31T08:53:42.957+00:00

    Hello,

    Welcome to Microsoft Q&A!

    AddressTablePage does not receive the message because you set different formatting on sending/subscribing, you should set the generic type when sending message .

    In AddressTableVM ,modify the code as below

    MessagingCenter.Send<Address>(item as Address, "deleted");

    Then the message would be received as expected.

    Thank you.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.